LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   auto running a script from command line (https://www.linuxquestions.org/questions/slackware-14/auto-running-a-script-from-command-line-369230/)

millionknives 10-02-2005 11:49 PM

auto running a script from command line
 
Ok so I know about autorun when in kde but I'd like a script to auto run while on the command line after logging in (I use runlevel 3) but, I can't seem to find anything on how this works and most likely I'm just missing it and not noticing so if anyones got any ideas do share as this would help make life a lot easier for me!

Thanks,
Knives

anomie 10-02-2005 11:53 PM

Quote:

I'd like a script to auto run while on the command line after logging in
Is it a big script or just a couple commands? If the latter, you might like to simply append it to your ~/.profile file.

millionknives 10-03-2005 12:11 AM

To be brutely honest I've never used the ~/.profile before sure I remember reading quite a while ago on how to make one and that its useful so I do it but never gave it much thought so I'll give that a go as its rather small and not to big.

anomie 10-03-2005 09:46 AM

You can just use something like
Code:

echo 'command_here' >> ~/.profile
for each command, in the order you'd like them to execute.

Or you can edit the ~/.profile file using vi or another text editor.

millionknives 10-03-2005 03:39 PM

Alright thanks and to verify this will do these in the order the commands are put in and the following will wait for the previous to complete before continueing correct?

PDock 10-03-2005 06:35 PM

The >> /.profile means add the prior command to the end of the /.profile file. To start over use command > /.profile. As to if prior command finishes first the use of sleep 3[4,5] >> /.profile ( pick one number only) should ensure completion of prior command prior to execution of hte next.

ppd

uopjohnson 10-03-2005 06:41 PM

you can also put script into /etc/profile.d/ and then they will run everytime anyone logs in (I think)

anomie 10-03-2005 10:07 PM

Quote:

Alright thanks and to verify this will do these in the order the commands are put in and the following will wait for the previous to complete before continueing correct?
Correct. When you're done you can always view the file with
Code:

less ~/.profile
to make sure you've added them correctly.


All times are GMT -5. The time now is 03:55 AM.