auto start script

Discussion in 'Desktop Operation' started by linuxuser1, Apr 11, 2006.

  1. linuxuser1

    linuxuser1 New Member


    How to i make this to start automatically
    5 * * * * /opt/jdk1.5.0_06/bin/java -jar /path/to/jwwim_server_sql2.jar localhost web1_db4 PASSWORD 5190 -l

  2. falko

    falko Super Moderator Howtoforge Staff

    Do you want to have this as a cron job? Then run
    crontab -e
    and enter that line there.
  3. Aiken

    Aiken New Member

    You realise that will run at 5 past every hour?

    If you mean you want it to start when the box is restarted then some versions of cron (such as Redhat) support @reboot so your crontab entry would be
    @reboot /opt/jdk1.5.0_06/bin/java -jar /path/to/jwwim_server_sql2.jar localhost web1_db4 PASSWORD 5190 -l
  4. falko

    falko Super Moderator Howtoforge Staff

    If you want to start it at boot time, you simply create a script like /etc/init.d/jwwim_server_sql2:

    /opt/jdk1.5.0_06/bin/java -jar /path/to/jwwim_server_sql2.jar localhost web1_db4 PASSWORD 5190 -l
    Then run
    chmod 755 /etc/init.d/jwwim_server_sql2
    and create the necessary system startup links. Depending on your distribution you can do it with chkconfig (RedHat, Fedora, CentOS, Mandriva, SuSE) or update-rc.d (Debian, Ubuntu).
  5. reddog

    reddog New Member

    Can any program be made to run at startup? for example: a teamspeak server, and a counter strike server. As long as i use the startup commands for the respective servers, in the code?
  6. falko

    falko Super Moderator Howtoforge Staff

    Yes, of course. :)
  7. atrias

    atrias New Member

    will the above run the commands as root ?
    is there a way to create a delay ?
    i need to start 2 programs and the first must be already started when the second starts.
    i hope this works for centos 5 !
  8. falko

    falko Super Moderator Howtoforge Staff


    You can either use the sleep command (see
    man sleep
    ), or create two cron jobs where the second one is executed after the first one.

Share This Page