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.
So I copied the script to the /etc/init.d/ folder ran the install command:
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.
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/
You continue to refer to /etc/init.d, but startup scripts are not run from /etc/init.d. And we have no idea what crusftp_init.sh does, nor why it had to be run from /etc/init.d.
So start with providing facts. Show output of “systemctl status crushftp.service”.
Hi
There is no crushftp.service file (yet…) nothing wrong with it there for the moment, it’s just a script, once the OP confirms it’s working as required, we can create a service file in /etc/systemd/system.
Hi
The .sh just tells the system what shell to use, but if you look at the first line in the script it has the ‘whole shebang’ #!/bin/sh which needs to change to #!/usr/bin/sh for openSUSE and is a softlink to /bin/bash anyway…
Anyway, can you move the script one directory up and see if it works;
cd /etc/init.d/crushftp/
mv crushftp_init.sh ../
./crushftp_init.sh start
Then can create a simple systemd service file for it.
Hey I used vi to edit a the service file and it seems ok. Do I need to chmod +x the resultant file?
When I check the status I get:
iisserver:/etc/systemd/system # systemctl status crushftp.service
crushftp.service - CrushFTP Server service
Loaded: loaded (/etc/systemd/system/crushftp.service; disabled)
Active: inactive (dead)
Apr 23 14:05:40 iisserver systemd[1]: Started crushftp.service.
Apr 23 14:05:40 iisserver sh[22195]: FAIL
Apr 23 14:05:40 iisserver systemd[1]: crushftp.service: main process exited, code=exited, status=1/FAILURE
Apr 23 14:05:40 iisserver systemd[1]: Unit crushftp.service entered failed state.
Apr 23 14:17:41 iisserver systemd[1]: Starting CrushFTP Server service…
Apr 23 14:17:41 iisserver systemd[1]: Started CrushFTP Server service.
Apr 23 14:18:21 iisserver systemd[1]: Starting CrushFTP Server service…
Apr 23 14:18:21 iisserver systemd[1]: Started CrushFTP Server service.
Apr 23 14:18:21 iisserver sh[22449]: Starting CrushFTP… OK
Apr 23 14:18:22 iisserver sh[22465]: Shutting down CrushFTP…OK
Not sure what I did wrong. I did move the init script to /etc/init.d/ before hand so the service file should be referencing the right location.
josh
EDITED! I had entered the text from your service template incorrectly. The first few times I tried to run the command it failed but now it starts and stops immediately!
This is way more involved that the sysv installation I did last time. I managed to hack the LSB tags onto a script provided by another user and suse 11 kept on ticking. I upgraded to 12.1 and I am pretty sure it kept working the same way. Now this is much different. Systemd is a strange beast to me thank you for your help.
The server isn’t up as of writing this. Does the service file we wrote start and stop the server at once?
-- Logs begin at Wed 2014-04-23 12:31:06 EDT, end at Wed 2014-04-23 14:23:53 EDT. --
Apr 23 14:05:29 iisserver systemd[1]: [/etc/systemd/system/crushftp.service:1] Assignment outside of section. Ignoring.
Apr 23 14:05:29 iisserver systemd[1]: [/etc/systemd/system/crushftp.service:2] Assignment outside of section. Ignoring.
Apr 23 14:05:40 iisserver systemd[1]: [/etc/systemd/system/crushftp.service:1] Assignment outside of section. Ignoring.
Apr 23 14:05:40 iisserver systemd[1]: [/etc/systemd/system/crushftp.service:2] Assignment outside of section. Ignoring.
Apr 23 14:05:40 iisserver systemd[1]: Starting crushftp.service...
Apr 23 14:05:40 iisserver systemd[1]: Started crushftp.service.
Apr 23 14:05:40 iisserver sh[22195]: FAIL
Apr 23 14:05:40 iisserver systemd[1]: crushftp.service: main process exited, code=exited, status=1/FAILURE
Apr 23 14:05:40 iisserver systemd[1]: Unit crushftp.service entered failed state.
Apr 23 14:17:41 iisserver systemd[1]: Starting CrushFTP Server service...
Apr 23 14:17:41 iisserver systemd[1]: Started CrushFTP Server service.
Apr 23 14:18:21 iisserver systemd[1]: Starting CrushFTP Server service...
Apr 23 14:18:21 iisserver systemd[1]: Started CrushFTP Server service.
Apr 23 14:18:21 iisserver sh[22449]: Starting CrushFTP... OK
Apr 23 14:18:22 iisserver sh[22465]: Shutting down CrushFTP...OK
Apr 23 14:23:53 iisserver systemd[1]: Starting CrushFTP Server service...
Apr 23 14:23:53 iisserver systemd[1]: Started CrushFTP Server service.
Apr 23 14:23:53 iisserver sh[22527]: Starting CrushFTP... OK
Apr 23 14:23:53 iisserver sh[22543]: Shutting down CrushFTP...OK
Do you guys know of a good book about linux that is complete but not thicker than all of the books of the bible, for someone of my ability. It is an artform that seems to require a lot of reading and practice, taming Linux. I keep getting flack from everyone that I am spending too much time on the internet and fiddling with the computer. I feel like I need to get more out of my readings.
Hi
Well you could try removing the ExecStop line from the service file and see if that helps.
I would get onto the crushftp folks and see if they have created a crushftp.service file for systemd, else remove the one we created and just start it manually for the moment.
Do you have a download link to the application, will see if can get something working here.