How to Automatically run two commands after login?

Posted by Covi on Ask Ubuntu See other posts from Ask Ubuntu or by Covi
Published on 2012-02-26T05:50:39Z Indexed on 2012/07/10 9:22 UTC
Read the original article Hit count: 173

Filed under:
|
|

I have these two commands that I need to manually run every time after login:

autossh -M 2000 -N -f -q -D 127.0.0.1:7070 [email protected]

and

sudo mkdir /media/C
sudo mount /dev/sda2 /media/C

I'd like to make them automatically run every time I boot and login to my computer. I'm currently using 10.04LTS.

BTW, I only vaguely know what init.d or runlevel mean. But I still prefer to know a command-line based way to achieve this, not a fancy GUI way. Also, the autossh will only succeed after Ubuntu automatically detect and connect to my network, so should we let it retry infinitely until successfully executed?

Thank you!

© Ask Ubuntu or respective owner

Related posts about startup

Related posts about command