|
Author |
Message |
|
|
Posted Jun 26, 2008 at 5:55:47 PM
Subject: Executing a program at startup using a script
I need to execute a program at startup in suse linux. For this, I created a script with name S99scadamonitor with following lines and copied the script to rc3.d and rc5.d. Runlevel of the system was found to be 5 when I used
who -r.
#! /bin/sh
/etc/local/scada/scmon 2 3 40
scmon is the program and 2 3 40 are command line arguments.
But, this script doesnot get executed. If the script is executed, then scmon is exected, and then it will fork into memory. I can click on the scipt and the script executes fine. It works in terminal mode also. (scmon The program starts normally and forks into memory as a background process, which can be seen later in system monitor.)
Where do you think is the mistake?
|
Khabi
Joined Apr 21, 2008 Posts: 88
Other Topics
|
Posted:
Jun 26, 2008 7:28:09 PM
Subject: Executing a program at startup using a script
init scripts can be tricky. I haven't used suse in a long time, but it seems you're missing something like this at the top of your init script:
### BEGIN INIT INFO
# Provides: FOO
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Description: Start FOO to allow XY and provide YZ
### END INIT INFO
On top of that init scripts usually need to take arguments like stop/start/restart, I'm not sure how suse is going to handle it w/o those.
From what I understand there should be an init script in /etc/init.d/skeleton that you can use as a template.
The other option is if scmon doesn't need to be started before networking then, add it to /etc/init.d/boot.local
|
Raj
Joined Jun 26, 2008 Posts: 8
Other Topics
|
Posted:
Jun 27, 2008 6:33:05 AM
Subject: Executing a program at startup using a script
In my suse machine, rc.d is mapped to init.d. skeleton is not existing in the folder.
Actually, I have an installation script, which copries the files from cd and then configures the program to autostart. I used to insert the line in rc.local using this installation script for sutostart. But then, I am forced to change that method since there is no rc.local file in suse. This script was tested in Redhat, and is working properly, but then when I tried it in Suse, it doesn't work since rc.local is simply not there!!
The script /etc/init.d/boot.local is available in suse. But is it available in all linux vserions? (Since I am using an installation script to configure autostart in target machines, the script is expected to work in all linux flavours!)
|
Raj
Joined Jun 26, 2008 Posts: 8
Other Topics
|
Posted:
Jun 27, 2008 10:27:53 AM
Subject: Executing a program at startup using a script
Is it necessary to use chkconfig and add the program to bootup?
|
klo
Joined Jun 28, 2008 Posts: 1
Other Topics
|
Posted:
Jun 28, 2008 7:12:50 PM
Subject: Executing a program at startup using a script
I'm not sure if suse supports upstart, if it does, try something like this in /etc/event.d (you can name it whatever you want):
Code:
start on runlevel 5
script
/etc/local/scada/scmon 2 3 40
end script
Good luck!
|
Raj
Joined Jun 26, 2008 Posts: 8
Other Topics
|
Posted:
Jul 02, 2008 4:15:09 PM
Subject: Executing a program at startup using a script
Tried the format suggested. But that script doesn't get executed at start up. Copied existing scripts and edited. Doesn't work. Used names starting from S. Copied to init.d and inserted links in rc3.d, rc5.d. Nothing works!! My script doesn't get executed. If I insert the code in boot.local, then it works, but, I don't get any visual indications etc. Like, the popups which were supposed to come doesn't come !! But then probably , that is the default behaviour, since boot.local is executed before all runlevels. In red hat, it works fine if I insert the code in rc.local. But in Suse, rc.local is doesn't exist. If I create rc.local (by copying boot.local and editing it, or by copying rc.local from redhat and editing it), then that is totally ignored by Suse. I am trying the event.d suggestion now, and hope it works...
|
Shashank Sharma
Joined Jan 01, 1970 Posts: 1361
Location:New Delhi, India
Other Topics
|
Posted:
Jul 04, 2008 11:16:11 AM
Subject: Executing a program at startup using a script
|