Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I followed the instructions here, but when I enter "sudo service mydaemon start". I get "mydaemon: unrecognized service". I have verified that the files are in the proper places, and I took the additional step of making my script file (echoHW.sh) executable, still no success. Any help whatsoever would be greatly appreciated.

share|improve this question
add comment

4 Answers

up vote 1 down vote accepted

I typed sudo crontab -e and then selected nano as my editor. It brought up nano with the below comments. I added my script at the bottom and then rebooted. My tasks are now running whenever the system is booted.

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
@reboot /path/to/script.sh
share|improve this answer
    
MAN I wish that had worked, but it didn't. Is there someplace I can look at a log file that might tell me what went wrong. –  davej Apr 17 '12 at 20:30
    
Actually, I checked the cron log, and it DID run. So now I've got to take a look at my scripts. Thanks! –  davej Apr 17 '12 at 20:51
add comment

Have you located and tried running the service the service in /etc/init.d/(service name)?

I am unfamiliar with invoking services without actually running the shell program located under init.d folder but I am sure if the shell program to start the service is located under init.d then it should be an easy setup so you can invoke it the way you wish - "service mydaemon [command]"

share|improve this answer
    
If you mean "sudo service /etc/init.d/mydaemon start", I just tried that (when sitting in /etc/init.d/), and got "/etc/init.d/mydaemon: unrecognized service". –  davej Apr 17 '12 at 20:33
    
In that case I would be concerned about the service properly installing on the machine, or that the shell command to start the program simply doesn't exist in the init.d folder for whatever reason. I am not a Linux pro by any means so I am unsure of how to assist from here. Is it a package you downloaded? Or is it a daemon/service you wrote? –  Stephen R Apr 17 '12 at 20:36
    
It was just the files as described in the page I referenced. –  davej Apr 17 '12 at 21:01
add comment

Have you set up Port Forwarding on your router? If not, setup port forwarding and your static ip adress + DNS (which you will need from a DNS provider or have your own DNS server). Port Forwarding Here.

share|improve this answer
    
It's all local at this point, ports aren't the issue. –  davej Apr 17 '12 at 21:48
add comment

It is possible to get that error if the script is not executable

sudo chmod +x /etc/init.d/mydaemon
share|improve this answer
    
The OP did state that the script was executable. –  suspectus Aug 7 '13 at 4:30
    
He made "echoHW.sh" executable, which from the article is the program to be called by the init script. I am saying that the script in init.d should be executable as well, Otherwise it raises the same error. –  a_huey Aug 7 '13 at 4:51
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.