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'm currently setting up a raspberry pi running Debian wheezy as an IRC server. It runs two programs as a regular user on boot - ngircd and atheme.

ngircd and atheme both log to /var/log/syslog

ngircd is started from the executable(/usr/local/sbin/ngircd ) itself, as is Atheme (/home/user/atheme/bin/atheme-services). Manually starting the programs as the user from a terminal works with no issues.

When I try to start ngircd (using the location its installed in) from cron, it simply doesn't start - /var/log/syslog says that the cron job ran, but nothing happens, there are no error messages, or any ngirc related logs at all. Atheme starts fine.

However if i create a script that does nothing but run ngird (using the same path i used earlier), and add that to cron, it works fine (as does running it directly). Why isn't ngircd starting from cron?

Its not a big issue, but it does make the system slightly messier than I'd like. Its also strange that the two programs behave differently

share|improve this question

1 Answer 1

I don't have the privilege to comment, so I can't ask for clarification, but I would suggest running the daemon either from an initscript or from rc.local, and not from cron. Cron is usually used to execute things at a certain time, regularly. The handling of daemons and services is usually a job for your init system.

To run something as a regular user on boot:

Add this to /etc/rc.local :

/bin/su -c '/path/to/your/executable args &' -s /bin/bash username >/dev/null 2>&1
share|improve this answer
    
for 'why' - I usually run IRC as a seperate user, with utterly restricted privileges, and assuming I have no access to the rest of the system. The irc setup I use is sort of to test, and to help folk who want an IRC setup of their own. I don't normally run ngircd, but the use of crontab is carried over from my old unreal/anope setup. @ reboot is a perfectly acceptable way of starting user level applications. While my setup is failing when run @ reboot, the same program would probably fail identically if it was a timed start. I got it 'working'. I want to know why it fails. –  Journeyman Geek Nov 8 '12 at 1:16

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.