Hi. I was missing a rc.local (as in redhat/fedora) in order to launch some programs/daemons AFTER the whole system has booted. I found "/etc/init.d/boot.local", but there we can read: # /etc/rc.d/boot.local # # Here you should add things, that should happen directly # after booting before we're going to the first run level. This is, things are launched BEFORE going into the first runlevel. In fedora's rc.local, things are launched AFTER the system has booted: # /etc/rc.d/rc.local # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. Well, I've made a script that simulates Fedora's rc.local. I show it since it can be useful for many people. It would be nice if Suse guys include something similar into next releases of Suse. Steps to simulate rc.local in Suse: 1) Create a "/etc/rc.d/rclocal" script, with this content: ---------------------------- #! /bin/sh ## This script simulates redhat's rc.local (Add commands at the end) ### BEGIN INIT INFO # Provides: rclocal # Required-Start: $local_fs $remote_fs $network # X-UnitedLinux-Should-Start: $ALL # Required-Stop: # X-UnitedLinux-Should-Stop: # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: Simulates rc.local # Description: Simulates redhat's rc.local: contains # commands to execute after system has booted (all services are already # available) ### END INIT INFO ## Execute ony when service is started case "$1" in start) ## commands will be executed ;; *) exit 0 ;; esac # vvvvv Add your commands bellow this line vvvvv ---------------------------- 2) Add executable permision: chmod +x rclocal 3) Create symlink to make it easy to find: ln -s rclocal rc.local 4) Activate the service by using yast2: yast2 > System > Runlevel editor > rclocal > Enable You can add/remove commands to /etc/rc.d/rc.local anytime you wish.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Wednesday 2005-07-20 at 15:50 +0200, Adrian wrote:
Well, I've made a script that simulates Fedora's rc.local. I show it since it can be useful for many people. It would be nice if Suse guys include something similar into next releases of Suse.
Interesting :-)
### BEGIN INIT INFO # Provides: rclocal # Required-Start: $local_fs $remote_fs $network
In fact, it only guarantees that it will run after those three services, but not after "all" services. Does it insert as the last service in your system?
# X-UnitedLinux-Should-Start: $ALL
This one is ignored in SLP. Pity. - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFC3/SItTMYHG2NR9URAtfcAJ461K7Awk49E3DgrnGmBKpBnHd3JgCfXbDn ZTQxDP3XVhEKBNcRezsqeRQ= =1wyj -----END PGP SIGNATURE-----
Carlos E. R. wrote:
The Wednesday 2005-07-20 at 15:50 +0200, Adrian wrote:
Well, I've made a script that simulates Fedora's rc.local. I show it since it can be useful for many people. It would be nice if Suse guys include something similar into next releases of Suse.
Interesting :-)
### BEGIN INIT INFO # Provides: rclocal # Required-Start: $local_fs $remote_fs $network
In fact, it only guarantees that it will run after those three services, but not after "all" services. Does it insert as the last service in your system?
In SuSE 9.3, the last init item to run, is the hardware monitor. Why not make it a "required" for your script. Also, since cron is the 2nd last item to run, an @reboot line in it might also be suitable.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Thursday 2005-07-21 at 15:42 -0400, James Knott wrote:
In SuSE 9.3, the last init item to run, is the hardware monitor. Why not make it a "required" for your script. Also, since cron is the 2nd last item to run, an @reboot line in it might also be suitable.
No, it is SuSEfirewall2_setup. Do a listing of "ls /etc/init.d/rc5.d/S*" to find out. The higher number listed is the last run script, ie: /etc/init.d/rc5.d/S22SuSEfirewall2_setup - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFC3/6/tTMYHG2NR9URAjPQAKCST/lWEkvdLN7aebd3Ma1Sts+BWACfWYzj UJSulUwDxYI4fUDsFzgBli0= =1KEy -----END PGP SIGNATURE-----
Carlos E. R. wrote:
The Thursday 2005-07-21 at 15:42 -0400, James Knott wrote:
In SuSE 9.3, the last init item to run, is the hardware monitor. Why not make it a "required" for your script. Also, since cron is the 2nd last item to run, an @reboot line in it might also be suitable.
No, it is SuSEfirewall2_setup.
Do a listing of "ls /etc/init.d/rc5.d/S*" to find out. The higher number listed is the last run script, ie:
/etc/init.d/rc5.d/S22SuSEfirewall2_setup
I was looking at my desktop system, when I wrote that. It doesn't have a firewall running. However, I just checked my firewall, and I see the Susefirewall. That said, cron may still run late enough for the OP to use.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Thursday 2005-07-21 at 21:09 -0400, James Knott wrote:
I was looking at my desktop system, when I wrote that. It doesn't have a firewall running. However, I just checked my firewall, and I see the Susefirewall. That said, cron may still run late enough for the OP to use.
Right, but the OP idea was to write a generalized script that can be ensured to run the last. There is another place you haven't noticed: /etc/init.d/after.local That script, if it does exist, is in fact run after "all" scripts, at the end of runlevel change (it is fired from /etc/init.d/rc at the same time it writes "Master Resource Control: ". ;-) - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFC4FMXtTMYHG2NR9URAuiYAJ0UT6S9BkbFBnObXizT+TM/wWW7TgCeMJ1l GQqArUx96No4/rtel9lBGkw= =VtJ3 -----END PGP SIGNATURE-----
Carlos E. R. wrote:
There is another place you haven't noticed:
/etc/init.d/after.local
That script, if it does exist, is in fact run after "all" scripts, at the end of runlevel change (it is fired from /etc/init.d/rc at the same time it writes "Master Resource Control: ".
;-)
I didn't know about that one. It appears that it should do the trick.
On Friday 22 July 2005 04:25, James Knott wrote:
Carlos E. R. wrote:
There is another place you haven't noticed:
/etc/init.d/after.local
That script, if it does exist, is in fact run after "all" scripts, at the end of runlevel change (it is fired from /etc/init.d/rc at the same time it writes "Master Resource Control: ".
;-)
I didn't know about that one. It appears that it should do the trick.
It's new for 9.3 though, so not relevant for all Both Required-Start: $all and Should-Start: $all will work
Ok guys, thanks for the feedback. After your good comments, and in order to help people looking for a rc.local, I think we can say that the example script given is correct, and that, once the 4 steps are done, the commands contained at the end of the script will be launched after the system has booted. When I wrote the script, my idea was to do it as compatible as possible with all Suse versions. Probably the "Required-Start: $local_fs $remote_fs $network" entry is not needed (the "X-UnitedLinux-Should- Start: $ALL" entry is sufficient), but I thought that, for old Suse versions that don't support the "X-UnitedLinux-Should-Start" entry (nor the "$ALL" value), it would be sufficient to launch the script after basic services. The optimal thing would be, for those old systems, to include the last launched service as the value, but then a generic rclocal script wouldn't be possible. Please give any suggestion you have to improve the example. Cheers El vie, 22-07-2005 a las 04:57 +0200, Anders Johansson escribió:
On Friday 22 July 2005 04:25, James Knott wrote:
Carlos E. R. wrote:
There is another place you haven't noticed:
/etc/init.d/after.local
That script, if it does exist, is in fact run after "all" scripts, at the end of runlevel change (it is fired from /etc/init.d/rc at the same time it writes "Master Resource Control: ".
;-)
I didn't know about that one. It appears that it should do the trick.
It's new for 9.3 though, so not relevant for all
Both Required-Start: $all and Should-Start: $all will work
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Friday 2005-07-22 at 10:14 +0200, Adrian wrote:
When I wrote the script, my idea was to do it as compatible as possible with all Suse versions. Probably the "Required-Start: $local_fs $remote_fs $network" entry is not needed (the "X-UnitedLinux-Should- Start: $ALL" entry is sufficient), but I thought that, for old Suse versions that don't support the "X-UnitedLinux-Should-Start" entry (nor the "$ALL" value), it would be sufficient to launch the script after basic services.
All "X-UnitedLinux*" entries are vendor extensions and not guaranteed to work in all SuSE systems. In fact, some of them are docuemented as ignored. Maybe "Required-Start: $all", as Anderson mentions, works, but I haven't checked. - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFC4Lk+tTMYHG2NR9URAtq/AJwLFq15oZoPJBmpHMZSHV/GkAfE8gCfZ0Fy 26euDIiXev3ZuHg6UNtcPD4= =FePi -----END PGP SIGNATURE-----
El vie, 22-07-2005 a las 11:15 +0200, Carlos E. R. escribió:
All "X-UnitedLinux*" entries are vendor extensions and not guaranteed to work in all SuSE systems. In fact, some of them are docuemented as ignored.
Maybe "Required-Start: $all", as Anderson mentions, works, but I haven't checked.
The "$all" pseudo name seems to be an UnitedLinux extension too: ( from http://www.chemie.uni-hamburg.de/tmc/stribeck/pv-wave/index_e.html ) ------------------------------ When specifying hard dependencies or ordering requirements, you can use names of services (contents of their Provides: section) or pseudo names starting with a $. The following ones are available according to LSB (1.1): $local_fs all local file systems are mounted (most services should need this!) $remote_fs all remote file systems are mounted (note that /usr may be remote, so many services should Require this!) $syslog system logging facility up $network low level networking (eth card, ...) $named hostname resolution available $netdaemons all network daemons are running The $netdaemons pseudo service has been removed in LSB 1.2. For now, we still offer it for backward compatibility. These are new (LSB 1.2): $time the system time has been set correctly $portmap SunRPC portmapping service available UnitedLinux extensions: $ALL indicates that a script should be inserted at the end ------------------------------ It would be interesting to know when did suse start to accept the Unitedlinux extensions, in particular the "$all" pseudo name. I've done a quick search, and the Unitedlinux faq ( http://www.unitedlinux.com/en/info/faqs.html ) tell about a roadmap for 2002. Maybe Suse started to support Unitedlinux extensions in 2002. In this case, the script would work correctly in Suse versions later than 2002. For older versions, the script will be launched after basic services ($local_fs $remote_fs $network). Well, at least for versions that support LSB 1.1 (any idea of which ones are they?). I'm thinking that, to ensure even more, we could add all LSB 1.1 pseudo names to the "Required-Start:" entry: $local_fs $remote_fs $syslog $network $named $netdaemons Any more ideas?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Thursday 2005-07-21 at 15:54 -0400, James Knott wrote: El 2005-07-21 a las 15:54 -0400, James Knott escribió:
# X-UnitedLinux-Should-Start: $ALL
This one is ignored in SLP. Pity.
How do you know it's ignored?
I remember reading it O:-) It is a "vendor" extension (excerpting from /etc/init.d/skeleton): # Any extensions to the keywords given above should be preceeded by # X-VendorTag- (X-UnitedLinux- X-SuSE- for us) according to LSB. ... # UnitedLinux extensions: # $ALL indicates that a script should be inserted # at the end Only a "UnitedLinux" distro has to comply by it. I remember reading that SLP doesn't - the problem is finding now where... ah, I found it, "man insserv": and calculating the dependencies between all scripts. Please note, that the Required-Stop, X-UnitedLinux-Should-Stop, and Default-Stop are ignored in SuSE Linux, because the SuSE boot script concept uses a differential link scheme (see init.d(7)). With known dependencies and runlevel(s) insserv sets and reorders the corresponding symbolic links of the concerned runlevels directories (see init.d(7)). Known run- levels are: - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD4DBQFC4DAntTMYHG2NR9URAs8QAJ0TXNh8/j4erme0we/F2efLo9Jx5ACVHpAO kdaCRLFa1R+C796/aCMPFg== =m/jK -----END PGP SIGNATURE-----
Carlos E. R. wrote:
The Thursday 2005-07-21 at 15:54 -0400, James Knott wrote:
El 2005-07-21 a las 15:54 -0400, James Knott escribió:
# X-UnitedLinux-Should-Start: $ALL This one is ignored in SLP. Pity.
How do you know it's ignored?
I remember reading it O:-)
It is a "vendor" extension (excerpting from /etc/init.d/skeleton):
# Any extensions to the keywords given above should be preceeded by # X-VendorTag- (X-UnitedLinux- X-SuSE- for us) according to LSB. ... # UnitedLinux extensions: # $ALL indicates that a script should be inserted # at the end
Only a "UnitedLinux" distro has to comply by it. I remember reading that SLP doesn't - the problem is finding now where... ah, I found it, "man insserv":
and calculating the dependencies between all scripts. Please note, that the Required-Stop, X-UnitedLinux-Should-Stop, and Default-Stop are ignored in SuSE Linux, because the SuSE boot script concept uses a differential link scheme (see init.d(7)). With known dependencies and runlevel(s) insserv sets and reorders the corresponding symbolic links of the concerned runlevels directories (see init.d(7)). Known run- levels are:
According to what I see, that only applies to the "Stop" functions. I don't see any mention of Start functions. Perhaps the best thing to do, would be to try using it.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 The Thursday 2005-07-21 at 21:35 -0400, James Knott wrote:
According to what I see, that only applies to the "Stop" functions. I don't see any mention of Start functions. Perhaps the best thing to do, would be to try using it.
True :-) - -- Cheers, Carlos Robinson -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFC4FQLtTMYHG2NR9URAurpAKCQjnTqsEGy571J8Y951C35TI5h8QCeJIEs i4JhyHKMGfacMSQps1vDX2o= =gcqE -----END PGP SIGNATURE-----
participants (4)
-
Adrian
-
Anders Johansson
-
Carlos E. R.
-
James Knott