Here you are:
This is for the case you get to your host by ssh...
Code:
#----------------
dany1:/export/home/vbe $ ll term*
total 10
drwxr-xr-x 2 vbe sysdso 3 Jun 7 11:27 .
drwxr-xr-x 4 vbe sysdso 9 Jun 7 11:27 ..
-rw-r--r-- 1 vbe sysdso 1073 Jun 7 11:28 2013-06-07_11:27:51.26677.log
dany1:/export/home/vbe $ ll .ssh/environment; cat .ssh/environment;
-rwx------ 1 vbe sysdso 192 Jun 7 10:45 .ssh/environment
# Set up the shell environment:
TMOUT=0
# Set up the shell variables:
EDITOR=vi
#ENV=$HOME/.kshrc
ENV=$HOME/.profile
HISTFILE=$HOME/.sh_history
HISTSIZE=10000
dany1:/export/home/vbe $
dany1:/export/home/vbe $ ll script_shell ; cat script_shell
-rwx------ 1 vbe sysdso 419 Jun 7 11:26 script_shell
if [ -z "$UNDER_SCRIPT" ]; then
logdir=$HOME/terminal-logs
if [ ! -d $logdir ]; then
mkdir $logdir
fi
gzip -q $logdir/*.log
logfile=$logdir/$(date +%F_%T).$$.log
export UNDER_SCRIPT=$logfile
echo logfile is : $logfile
#read kyb
#script -f -q $logfile
script -a $logfile
echo " exiting ..."
sleep 1
exit
fi
dany1:/export/home/vbe $ cat term*/* # I am looking at your log content (hehe you see it works...)
Script started on Fri Jun 07 11:27:51 2013
dany1:/export/home/vbe $ ll
sh: ll: not found
dany1:/export/home/vbe $ r alias
alias ll='ls -al'
dany1:/export/home/vbe $ ll
total 38
drwxr-xr-x 4 vbe sysdso 9 Jun 7 11:27 .
drwxr-xr-x 21 root root 21 Jun 10 2011 ..
-rwx------ 1 vbe sysdso 6651 May 27 14:06 .kshrc
-rw-r--r-- 1 vbe sysdso 725 Jun 7 11:20 .profile
-rw------- 1 vbe sysdso 3056 Jun 7 11:28 .sh_history
drwx------ 2 vbe sysdso 3 Jun 7 10:45 .ssh
-rw-r--r-- 1 vbe sysdso 50 Dec 7 2007 dsmerror.log
-rwx------ 1 vbe sysdso 419 Jun 7 11:26 script_shell
drwxr-xr-x 2 vbe sysdso 3 Jun 7 11:27 terminal-logs
dany1:/export/home/vbe $ tail .profile
then
echo " Enter DISPLAY = "
read DISPLAY
export DISPLAY
fi
alias -x ll='ls -al'
export PS1=`uname -n`':$PWD \$ '
printf "\033]0;$(hostname) \007"
exec $HOME/script_shell
dany1:/export/home/vbe $ exit
script done on Fri Jun 07 11:28:43 2013
dany1:/export/home/vbe $
In other words if you telnet , remsh or rlogin, the append in .profile is enough, if you get to remote via ssh, you will have to create if you have no file environment as I show you above.
By X means to correct .dtprofile to make it read .profile:
bottom of .dtprofile:
Code:
# # login screen, login and correct the error. The $HOME/.dt/startlog and
# # $HOME/.dt/errorlog files may be helpful in identifying errors.
# #
# ##########################################################################
#
# If $HOME/.profile (.login) has been edited as described above, uncomment
# the following line.
#
DTSOURCEPROFILE=true
ADDENDUM:
Just read your last question: exec here I use exec since when the command script ends, the forked shell exits, and you find yourself at your login prompt... which I suspect is not what you want.
exec will make the forked shell, the current shell that will at exit end the session... as you can see on my first code trace above
Last edited by vbe; 06-07-2013 at 07:13 AM..
Reason: ADDENDUM
Hi,
How do I "run a script"?
I'm trying to start up some software called ElectroServer 3, and was told I just needed to "run the start script from the terminal to get things going".
From the terminal, i use cd command to change to the software's directory, and I guess the script in question is... (4 Replies)
hi
i want to know the way by which i put any file somewhere and it get s started when the system restarts or bots
i mean whenever my system starts that application must also start
thanks (3 Replies)
Hi everyone,
I'm pretty new using UNIX, but a friend of mine was helping me configure the unix terminal on my mac, and he changed some stuff on the bash profile .bash_profile. Everything was going well until I shut my computer and restarted it. When I opened the terminal this time this is what... (1 Reply)
I have put the file descriptor 1 to file, using command exec 1>>out.txt
Then I could not see any output on the screen, how could I restore the default output to terminal? :mad: Thanks (3 Replies)
Hi all,
I am trying to write a script that launch the cisco vpn client from the command line and then connects to a remote host using ssh.
When i connect to the cisco vpn using vpnclient client connect the last lines of output from that client is
Encryption: 168-bit 3-DES
Authentication:... (0 Replies)
Hello sir,
I want to monitor my work on the terminal.I know we can use script command.But every time when I start the terminal, I have to type script to start it.I want to automate it. So where should I include this command so that it will start as soon as I start the terminal ???? (2 Replies)
Hello Guys
Please let me know how to solve the below issue
I have a file like below
drop table R1416.ABC1 cascade constraints;
drop table R1416.ABC2 cascade constraints;
drop table R1416.ABC3 cascade constraints;
drop table R1416.ABC4 cascade constraints;
drop table R1416.ABC5... (7 Replies)
Hello.
Normally when you double click on the file name, the shell script start in background.
If you want to see what is going on, you must open a terminal console and start the shell within the terminal.
Is it possible to start directly a shell script in a terminal console from the file... (0 Replies)
when I run C:\cygwin\bin\run C:\cygwin\bin\startxwin.exe it fires up a terminal by default. Can I eliminate that terminal and start the x server as a service silently and sits in my status bar just there? Thanks Jack (0 Replies)