Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-24-2013, 10:01 AM   #1
LQ Newbie
Registered: Mar 2004
Posts: 17

Rep: Reputation: 0
Question Login automatically trigger batch file/shell script

OK, I am after some help getting a shell script to auto start when I login to my system.

I know the commands I want to use

first when I login I have to rebind my net connection, which is running through net sharing via ethernet on my mac. I have the SSH setup and terminal setup fine. I am using
sudo ifup eth0
to enable my setup to connect to the web.

The next thing I always do is fire up aplitude to update the system. I am using
sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get clean && sudo apt-get upgrade && sudo apt-get clean
My thoughts are to use


sudo ifup eth0 && sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get clean && sudo apt-get upgrade && sudo apt-get clean'
I know I could get this hardcoded into the system files but I'm not to confident in terms of doing that yet. What I am trying to find out is how to get this to launch automatically at login from the user account. Any help would be appreciated.

Note: I am running the Raspbian Hard Float fork/derivative of Debian. Afaik this should not cause issues but if it will please let me know.
Old 04-24-2013, 10:07 AM   #2
LQ Guru
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,111

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
two options. you can append those lines (or call the script) in ~/.profile (mite be ~/.bash_profile depending on distro/shell).

most newer distros support an @reboot line in the users crontab.

for the system to run it upon reboot as root you would add it to /etc/rc.local
1 members found this post helpful.
Old 04-24-2013, 10:48 AM   #3
LQ Newbie
Registered: Mar 2004
Posts: 17

Original Poster
Rep: Reputation: 0
OK, found the .profile file in /home/pi, added bits and they execute on login! many thanks for that


automatic, login, networkconfig, update

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
any shell script 2 batch file tools? rosbur Linux - General 10 08-04-2012 09:48 AM
Help me convert this batch file to shell script.. debb22 Programming 6 03-17-2012 01:39 PM
Batch file conversion to shell script aullah Linux - General 2 08-16-2011 03:00 AM
Need to convert a batch file to a shell script webshore Linux - Newbie 2 05-03-2010 07:42 AM
Trigger linux command by windows batch file? mariusak Linux - Networking 6 06-03-2005 05:15 AM

All times are GMT -5. The time now is 04:08 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration