Last few days I was trying out some new script in which we had to log in and start the script.. Well while I messed up the whole thing as I had put the script before logging in and I could not use my computer furthermore( ofcourse, I removed the script but that is something different) so I decided to put how to put a script before logging in and after logging in Ubuntu
PUT A SCRIPT BEFORE LOGGING IN
- Write your script in bash
- Save it in a file named startup or anything you wish to..
- Copy this file to the directory /etc/intit.d/ (you may use cp -v source destination or mv -v source destination)
- Make your copied script executable by using chmod +x startup
- then type the following commands update-rc.d startup defaults
INSERTING A SCRIPT AFTER LOGGING IN
- Doing this is as easy as doing it in Windows
- Go to System->Preferences->StartUp Applications
- Click Add
- Write your App’s name
- Make sure your app is executable and provide a link to it in the command prompt
- You can also a bash command in command dialog box
- Enter a description if you want to
- Click Ok and you are done…
/etc/intit.d/ should be /etc/init.d/
LikeLike