Page 1 of 4 123 ... LastLast
Results 1 to 10 of 37

Thread: Getting Shell script to start java app on boot

  1. #1

    Default Getting Shell script to start java app on boot

    Hello,

    I have been struggling with a .sh file that works when executed but I can't get it to launch an application at boot. I have tried

    sh ./crushftp_init.sh
    and also creating a symbolic link and copying the script to init.d


    I am afraid I am confused as last time I did this linux was using sysv which worked once I had the service showing up under the chkconfig -list

    Systemd is confusing to me. I am not sure what the process is. I see the scripts are compatible with the LSB tags. I just don't understand how to make systemd launch an application or it's structure.

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    32,352
    Blog Entries
    15

    Default Re: Getting Shell script to start java app on boot

    Quote Originally Posted by jvamos View Post
    Hello,

    I have been struggling with a .sh file that works when executed but I can't get it to launch an application at boot. I have tried

    sh ./crushftp_init.sh
    and also creating a symbolic link and copying the script to init.d


    I am afraid I am confused as last time I did this linux was using sysv which worked once I had the service showing up under the chkconfig -list

    Systemd is confusing to me. I am not sure what the process is. I see the scripts are compatible with the LSB tags. I just don't understand how to make systemd launch an application or it's structure.
    Hi
    If it's an init file, then you would need to add start to your command line;
    Code:
    ./crushftp_init.sh start
    If you post the script, it should be easy to create a crushftp.service file
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  3. #3
    Join Date
    Oct 2008
    Location
    Glasgow, Scotland
    Posts
    1,277

    Default Re: Getting Shell script to start java app on boot

    Quote Originally Posted by jvamos View Post
    I have been struggling with a .sh file that works when executed but I can't get it to launch an application at boot.
    My inelegant, quick workaround for this sort of thing is to place an "@reboot" entry in root's crontab.
    --
    slàinte mhath,
    rayH

    ~ knowing the right answer is easier than knowing the right question.

  4. #4
    Join Date
    Sep 2012
    Posts
    7,106

    Default Re: Getting Shell script to start java app on boot

    Quote Originally Posted by jvamos View Post
    last time I did this linux was using sysv which worked once I had the service showing up under the chkconfig -list

    Systemd is confusing to me.
    It still works exactly the same with systemd.

  5. #5

    Default Re: Getting Shell script to start java app on boot

    Quote Originally Posted by arvidjaar View Post
    It still works exactly the same with systemd.
    Ok I must have done something incorrectly if it's the exact same. The script has changed though. Here is a sample.

    http://pastebin.com/WH9rqkrr

  6. #6
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    32,352
    Blog Entries
    15

    Default Re: Getting Shell script to start java app on boot

    Quote Originally Posted by jvamos View Post
    Ok I must have done something incorrectly if it's the exact same. The script has changed though. Here is a sample.

    http://pastebin.com/WH9rqkrr
    Hi
    So did you run the command with the start option?

    If you copy the above file to the /etc/init.d/ directory and then try starting it, what happens?
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  7. #7

    Default Re: Getting Shell script to start java app on boot

    Quote Originally Posted by malcolmlewis View Post
    Hi
    So did you run the command with the start option?

    If you copy the above file to the /etc/init.d/ directory and then try starting it, what happens?
    Hey malcolmlewis thanks for your help.

    So I copied the script to the /etc/init.d/ folder ran the install command:
    Code:
    sh ./crusftp_init.sh
    Then used the installed script to launch the program. All works well with the script. There is a java process visible using top and the GUI is available as it should be.
    I then rebooted the machine and it can confirm it doesn't launch on boot.

    In my init.d folder it may be a mess... I tried linking to the script.

    http://pastebin.com/SudTJziH

  8. #8
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    32,352
    Blog Entries
    15

    Default Re: Getting Shell script to start java app on boot

    Hi
    OK, lets do some clean up and try starting it....
    Code:
    su -
    cd /etc/init.d
    rm crushftp crushftp_init.d
    mv crushftp_init.sh crushftp
    chmod 0700 crushftp
    ln -s /etc/init.d/crushftp /usr/sbin/rccrushftp
    rccrushftp start
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

  9. #9

    Default Re: Getting Shell script to start java app on boot

    Quote Originally Posted by malcolmlewis View Post
    Hi
    OK, lets do some clean up and try starting it....
    Code:
    su -
    cd /etc/init.d
    rm crushftp crushftp_init.d
    mv crushftp_init.sh crushftp
    chmod 0700 crushftp
    ln -s /etc/init.d/crushftp /usr/sbin/rccrushftp
    rccrushftp start
    I removed all the old stuff and placed the crushftp_init.sh script in /etc/init.d/crushftp
    The link didn't work. Wouldn't I need to link soft link to the actual script not the containing folder? Also the program's jar file is in /var/opt/Crushftp_7/
    The rccrushftp link is where I am now lost. rccrushftp also hasn't been installed yet as a service.
    ./crushftp_init.sh now works when I am in the correct folder ie /etc/init.d/crushftp/

    Josh

  10. #10
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    32,352
    Blog Entries
    15

    Default Re: Getting Shell script to start java app on boot

    Quote Originally Posted by jvamos View Post
    I removed all the old stuff and placed the crushftp_init.sh script in /etc/init.d/crushftp
    The link didn't work. Wouldn't I need to link soft link to the actual script not the containing folder? Also the program's jar file is in /var/opt/Crushftp_7/
    The rccrushftp link is where I am now lost. rccrushftp also hasn't been installed yet as a service.
    ./crushftp_init.sh now works when I am in the correct folder ie /etc/init.d/crushftp/

    Josh
    Hi
    So you now have a folder /etc/init.d/crushftp? and in that folder exists crushftp_init.sh and when you run;
    Code:
    ./crushftp_init.sh start
    It works as expected?
    Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
    SUSE SLE, openSUSE Leap/Tumbleweed (x86_64) | GNOME DE
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!

Page 1 of 4 123 ... LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •