Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've tried using a /etc/init.d/ script, an upstart script, crontab, etc. None of the above are causing the script to execute on boot.

The service I am attempting to automatically start on boot is Upsource 2.0

The /etc/init.d/upsource script is executable, and I can run it using

service Upsource start

The contents of /etc/init.d/Upsource are as follows

#!/bin/sh
# /etc/init.d/Upsource

/opt/Upsource/bin/upsource.sh start

I have already run

update-rc.d Upsource defaults

The contents of /etc/init/upsource.conf are as follows

#Upsource

start on runlevel [2345]
stop on runlevel [016]

respawn
expect fork

chdir /opt/Upsource/bin

exec upsource start

The last lines of crontab -e is as follows

@reboot service Upsource start
@reboot echo "hello" > /root/downloads/test.txt

I can see /root/downloads/test.txt, and using cat on it results in "hello" being displayed, so I know it's running. When I issue reboot to the server the Upsource service is not automatically started, I have to issue the command manually for the service to start.

share|improve this question
    
Do you really have a space after ! in your shebang line in the script? – Eric Renouf Feb 2 at 15:18
    
Yes, I've gone ahead and removed that whitespace. After another reboot the issue is still occurring. ps aux | grep Up shows no instance of the service running. After manually starting the service however the process is there. – EnduranceMan Feb 2 at 15:20
    
You can have spaces after the shebang without a problem. But your Upsource has no dependency on other fhings (network e.g.), is there anything that might not be ready yet once cron is started that causes this? (add a "start on filesystem and network" stanza or something similar to the Upstart file). Alternatively look at what happens if you put things in /etc/rc.local, that is started very late in the startup sequence – Anthon Feb 2 at 15:25
1  
I had done that because when inspecting /etc/init.d/ssh the first line was #! /bin/sh (with the whitespace). – EnduranceMan Feb 2 at 15:27
1  
@EricRenouf Since when can't you have a space after a shebang. It was first documented with an optional space – Anthon Feb 2 at 15:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.