You are not logged in.

#1 2011-09-03 07:34:28

Lockheed
Member
Registered: 2010-03-16
Posts: 1,440

Root command at startup?

I am trying to add time sync command to my startup script. I tried

sh -c "sleep 40 && gksu ntpd -qg" &

but unsurprisingly it doesn't work. It needs to run ~40 seconds after X started as it is pointless before it connects to wifi.


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#2 2011-09-03 07:48:43

krisoijn
Member
Registered: 2011-03-18
Posts: 15
Website

Re: Root command at startup?

archlinux-wiki wrote:

Syncing the clock without running the daemon
Warning:
Using this method is highly discouraged on servers and in general on machines that need to run continuously for more than 2 or 3 days, as the system clock will be updated only once at boot time.
Running "ntpd -qg" as a cron event is to be completely avoided, unless you are perfectly aware of how your running applications would react to instantaneous system time changes.

What you need is https://wiki.archlinux.org/index.php/Nt … s_a_daemon

With that out of way, gksu is a GTK frontend for su.
You may need to

export DISPLAY=":0"

Last edited by krisoijn (2011-09-03 07:51:47)

Offline

#3 2011-09-03 07:50:10

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: Root command at startup?

Maybe your network management tool can run it for you after the net comes up? I know netcfg can do that anyway.

Offline

#4 2011-09-03 07:52:38

Lockheed
Member
Registered: 2010-03-16
Posts: 1,440

Re: Root command at startup?

I am using WICD. I doubt it has such capabilities.

As I already know how to run delayed commands from startup script (I run checkgmail and several other programs this way), all I need in essence, is a way to run root-privileged command from startup script.


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#5 2011-09-03 07:55:01

krisoijn
Member
Registered: 2011-03-18
Posts: 15
Website

Re: Root command at startup?

What startup script is it anyway? .xinitrc or rc.local?

Offline

#6 2011-09-03 07:56:46

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 20,108
Website

Re: Root command at startup?

Lockheed wrote:

I am using WICD. I doubt it has such capabilities.

http://wicd.sourceforge.net/moinmoin/Ad … %20scripts

Last edited by jasonwryan (2011-09-03 07:59:10)


Arch + dwm   •   Mercurial repos  •   Github

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB