=== Running a script at startup === **Warning**: be sure to test your startup scripts manually in a Terminal session (Ctrl-Alt-T in Easy Mode) before following either of the methods below. If your script prevents the graphical desktop from starting properly, your machine may enter an endless boot loop, requiring you to resort to using the [[howto:installrescuemode|Rescue Console]]. == Easy Mode == - Open a Terminal (Ctrl-Alt-T in Easy Mode). - If /home/user/.icewm does not exist, create it. (check for it by "ls -a /home/user"; create it with "mkdir /home/user/.icewm) - In that folder, create a file called startup ("touch startup"). - Make it executable now, before you forget ("chmod 0755 startup"). - Edit it and insert your commands, ensuring that the 1st line is "#!/bin/sh" ("nano /home/user/.icewm/startup") - Now, make a copy of /usr/bin/startsimple.sh ("sudo cp /usr/bin/startsimple.sh /usr/bin/startsimple.sh.orig") - Open the file with nano editor in super-user mode ("sudo nano /usr/bin/startsimple.sh") - Look for the following line: "/opt/xandros/bin/AsusLauncher &" - Insert the following code just above it, then save and reboot. if [ -x /home/user/.icewm/startup ]; then #we have a start up file to execute /home/user/.icewm/startup & fi == Advanced Mode (KDE) == - Open a text editor as root (EX: kdesu kwrite ) - Write your script. Ensure that the first line of the script is: #!/bin/sh (otherwise it will be opened in the Text Editor). - Save the script to /home/user/.kde/Autostart/ - Give the script execute permission (chmod 0755 /home/user/.kde/Autostart/example.sh) - Reboot == Xubuntu 7.10 == - Save the script to ''**/home/YourUserName/ExampleName.sh**'' ( the first line of the script //must// be ''**#!/bin/sh**'' ) - Give the script execute permission ''**chmod 0755 /home/YourUserName/ExampleName.sh**'' - Select from your main menu: Applications --> Settings --> Autostarted Applications * Click **Add** * Name the application //e.g.: **Example Script**// * Describe the application //e.g.: **This is my example script, that makes an example of every user on bootup!**// * Command: enter the path to the script: //i.e.: **/home/YourUserName/ExampleName.sh**// (Or use the button for the file chooser to find the script.) * Click **OK** * Make sure that the new entry in the //Autostarted Applications// dialog is **checked**. * Click **Close** - Reboot == Ubuntu 7.10 == - Save the script to ''**/home/YourUserName/ExampleName.sh**'' ( the first line of the script //must// be ''**#!/bin/sh**'' ) - Give the script execute permission ''**chmod 0755 /home/YourUserName/ExampleName.sh**'' - Select from your main menu: System --> Preferences --> Sessions * Select //Startup Programs// tab if it is not already selected. * Click **New** * Name the application //e.g.: **Example Script**// * Command: enter the path to the script: //i.e.: **/home/YourUserName/ExampleName.sh**// (Or use the //Browse...// button for the file chooser to find the script.) * Click **OK** * Make sure that the new entry in the //Startup Programs// tab of the //Sessions// dialog is **checked**. * Click **Close** - Reboot == Xubuntu / Ubuntu 7.10 (ALL USERS) == - As root, save the script to ''**/etc/ExampleName.sh**'' ( the first line of the script //must// be ''**#!/bin/sh**'' ) - Still as root, give the script execute permission ''**chmod 0755 /etc/ExampleName.sh**'' - Edit ''**/etc/rc.local**'' (again, as root) and add the full path to your script above the ''**exit 0**'' line (place a nice comment above the edit, explaining the command to your older self -- any line that starts with a ''**#**'' is a comment) # This is my example script, that makes an example of every user on bootup! /etc/ExampleName.sh exit 0 * Reboot All users, not just the current user, will be affected by the script. - If your script requires X, you can add the lines of the script to the bottom of the /etc/gdm/Init/Default script, right before 'exit 0'. Or call it from the Default script. This is the way to add xmodmap changes to all users.