Ask Your Question
3

How to start a program automatic

asked 2014-08-03 13:19:30 -0500

Tiger gravatar image

updated 2014-09-28 19:13:02 -0500

mether gravatar image

anyone can tell me that how to start a program automatic after my os (FEDORA 20) start........??

edit retag flag offensive close merge delete

Comments

Updated tags. Please don't have # in tags.

abadrinath gravatar imageabadrinath ( 2014-08-03 22:39:10 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
8

answered 2014-08-03 22:50:06 -0500

abadrinath gravatar image

updated 2014-10-22 04:35:26 -0500

Method 1: Use the init scripts

  1. Add your script/shell script to the folder named /etc/init.d. How to do that is described below.
  2. Use your favorite text editor (gedit, kwrite, kate, etc.) and then create a file in /etc/init.d.
  3. After editing and saving (note: this must be done by root privileges), you have to make the file executable.
  4. Do that using chmod +x /etc/init.d/SCRIPTNAME.sh.
  5. Reboot, and it will autostart your script!

Method 2: Use /etc/xdg/autostart (or /usr/share/autostart)

  1. While using /etc/xdg/autostart (or /usr/share/autostart) keep in mind that your script will have to be a .desktop file. This can mean two things, make the a.desktop file execute the myscript.sh file or you can have individual commands in the a.desktop file. A more detailed guide is below:
  2. Use your favorite text editor (gedit, kwrite, kate, etc.) and then create a file in /etc/xdg/autostart.
  3. Edit and save (note: this must be done by root privileges). No need to make the file executable.
  4. A desktop file should look something like this:
[Desktop Entry]
Type=Application
Name=xscreensaver-autostart
Comment=Autostart xscreensaver
Exec=/usr/libexec/xscreensaver-autostart
Terminal=false
X-Desktop-File-Install-Version=0.22
OnlyShowIn=GNOME;

Note the [Desktop Entry] at the top.

  1. The Exec part should contain the path (full) to the script.

Method 3: Use user-specific autostart

  1. To do this for your user only, head over to the autostart section in System Settings.
  2. Click on Add, and specify script.
  3. Log out and back in.

OTHER WAYS:

  1. Create a script in your home directory.
  2. Execute this command:
mv $HOME/myscript.sh .config/autostart
  1. Log out and back in.

Also, you may be able to use:

$ gnome-session-properties

if in GNOME. :)

HTH.

edit flag offensive delete link more

Comments

thnkq sir.... :)

Tiger gravatar imageTiger ( 2014-08-04 11:45:25 -0500 )edit

Thank you good man...

enjay gravatar imageenjay ( 2014-08-05 07:06:07 -0500 )edit

Mark as correct, @Tiger?

abadrinath gravatar imageabadrinath ( 2014-08-05 18:09:50 -0500 )edit

@NikTh or @hedayat - mark as correct? I can't. :(

abadrinath gravatar imageabadrinath ( 2014-08-21 06:58:26 -0500 )edit

It seems that I can!

hedayat gravatar imagehedayat ( 2014-08-21 07:47:21 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2014-08-03 13:19:30 -0500

Seen: 34,605 times

Last updated: Oct 22 '14