I have installed on my PC an Expert mouseClock (Gude elektronik) receiving the time radio signal of DCF77 in Germany. It is functioning perfectly. My problem is the following: how do I start this service as root at boot?
I have written the following script in a file called ntpd in the /etc/init.d folder:
#!/bin/bash
/usr/local/bin/ntpd
then I have made it executable:
chmod 755 ntpd
I have seen that this file was copied in /etc/rc.d.
Then when I launch my system, this service is not started and I get the following line in the file /var/log/messages:
Jun 21 14:02:01 Piantino-8 ntpd[4219]: ntpd 4.2.4@1.1437 Thu Jun 4 14:04:29 UTC 2009 (1)
Jun 21 14:02:01 Piantino-8 ntpd[4219]: ntpd: must be run as root, not uid 1000
How do I manage to run it as root?
Thank you in advance for your answer
Gian-Piero wrote:
> I have installed on my PC an Expert mouseClock (Gude elektronik)
> receiving the time radio signal of DCF77 in Germany. It is functioning
> perfectly. My problem is the following: how do I start this service as
> root at boot?
> I have written the following script in a file called ntpd in the
> /etc/init.d folder:
>> #!/bin/bash
>> /usr/local/bin/ntpd
>>
> then I have made it executable:
>> chmod 755 ntpd
> I have seen that this file was copied in /etc/rc.d.
> Then when I launch my system, this service is not started and I get the
> following line in the file /var/log/messages:
>> Jun 21 14:02:01 Piantino-8 ntpd[4219]: ntpd 4.2.4@1.1437 Thu Jun 4
>> 14:04:29 UTC 2009 (1)
>> Jun 21 14:02:01 Piantino-8 ntpd[4219]: ntpd: must be run as root, not
>> uid 1000
> How do I manage to run it as root?
> Thank you in advance for your answer
>
chkconfig
insserv
But why don’t you just have the system ntpd use your clock?
Configue it in /etc/ntpd.conf,
/etc/init.d/ntp start
chkconfig -a ntp
I doubt that you need your own ntpd.
Kind regards,
Andreas Stieger
Thank you for your answer.
But the clock has to be run by a special package and the manufacturer insists on the fact that no other ntp distributions (e.g. suse rpms, debian packages) is installed.
Kind regards.
Gian-Piero wrote:
> But the clock has to be run by a special package and the manufacturer
> insists on the fact that no other ntp distributions (e.g. suse rpms,
> debian packages) is installed.
In that case you can of yourse use your special ntpd and copy/adjust the
init script from the distribution package. Alternatively, copy and
adjust the fully documented /etc/init.d/skeleton to create your own
automatically started start/stoppable ntp service.
Kind regards,
Andreas Stieger
Thank you for your answer.
I have found the following script in the distribution package:
#! /bin/bash
case “$1” in
start)
echo -n “Starting ntpd "
/usr/local/bin/ntpd
echo -e " done”
;;
stop)
echo -n “Shutting down ntpd:”
killall /usr/local/bin/ntpd
echo -e " done"
;;
reload|restart)
$0 stop && $0 start
;;
status)
echo -n "Checking for service ntpd: "
checkproc /usr/local/bin/ntpd && echo OK || echo No process
;;
*)
echo “Usage: $0 {start|stop|status|reload|restart}”
exit 1
esac
I have put it in /etc/init.d and made it executable.
Now I can see the service ntpd in Yast2, but its activity is " No* " (I hope my translation is correct because my version of openSUSE 11.1 is in French).
This service is always not started at boot, because it requires root access.
I can start it manually from within Yast2 or from a terminal as root.
My problem still is: how can I manage to start this service as root automatically?
As I am far from being a specialist can you tell me what I have to do?
Kind regards
You have to put a whole bunch of metadata in significant comments at the top of the file to make it installable into openSUSE’s SysV init system using insserv or chkconfig. See /etc/init.d/skeleton for an example and documentation.
Thank you for your help. I will try.
Regards
After some trials and errors, I succeeded.
Thank you.