Automatic Execution of Script After Logging In
Hi All,
I'm new in using shell scripts. I managed to create a simple script that allows me to input and view schedules. I heard it's possible to setup a script to automatically run once I log in. I was hoping to have my schedules for the day display on the screen once I logged in. Say for example I logged in today and all my schedules for 07/31/2012 will be shown. Thanks in advance for your reply. |
You could add that to the bottom of your .bash_profile file, which exists in your home dir eg
Code:
/home/you/.bash_profile |
Thanks for the swift reply. I hope this is mainly an error on my part but I can't seem to locate the bash profile. I found a .bash_history and .bash_log but no .bash_profile.
Thanks again! |
I think here you will find that mentioned "bash_profile" file.
You don't say which distro you are using, please provide more info about it . |
That would be odd unless you are not using the bash shell.
Can you grep your entry in /etc/passwd and double-check Code:
echo $SHELL |
Hi,
When I tried "echo $SHELL" on the command line the output is /bin/bash. I've also managed to check the passwd in etc. To lithos: I'm sorry but what do you mean by distro and how could I check it? Thanks again! |
He means like Ubuntu, Debian, Fedora, Red Hat, etc.
|
To Awesome Machine:
I see. Thanks for the information. To lithos: I am using Ubuntu. |
If your entry in /etc/passwd says you are using bash, then normally you would have installed .bash_profile & .bashrc.
Basic versions are usually available in /etc/skel, although it may be different in Ubuntu. See the link mentioned above http://www.cyberciti.biz/faq/howto-c...-user-account/ You can create them via an editor if necessary, with following perms/ownerships Code:
-rw-r--r-- 1 username usrgrp 260 Oct 18 2011 .bash_profile Typical contents Code:
# .bash_profile Useful links http://rute.2038bug.com/index.html.gz http://tldp.org/LDP/Bash-Beginners-G...tml/index.html http://www.tldp.org/LDP/abs/html/ |
I've tried add the run command for my script at the end of .bashrc and it only works when I open terminal. It doesn't show after I logged in.
I also tried the same using .bash_profile and it has the same result. I tried the suggestion from another site to include the run command for the script in the Startup Applications and still unsuccessful. Is this step not applicable to Ubuntu 12.04 LTS because that is what I'm using. Hopefully this is of the source of this issue. I'll try adding the script in the /etc/init.d/ directory though a friend of mine said it doesn't work with his script. Are there any other possible ways? I do remember when using Windows we had a autoexec.bat. Is there an equivalent of this kind of file in Ubuntu? Hope to resolve this soon. |
All times are GMT -5. The time now is 06:54 AM. |