Unable to Run a script at startup in suse

 
Thread Tools Search this Thread
Operating Systems Linux SuSE Unable to Run a script at startup in suse
# 1  
Old 07-29-2010
Unable to Run a script at startup in suse

Hi

I have a script myscript.sh that needs to be run whenever the server boots. The script is actually logging Syslog-ng messages to sql server. I need to lauch it at startup

I have copied the script in etc/init.d

i have also added the link

Code:
ln -s /etc/init.d/syslog-ng-mssql-pipe.sh /etc/init.d/rc5.d/S99syslog-ng-mssql-pipe

It doesnt work


Please help

Last edited by Scott; 07-31-2010 at 06:58 AM.. Reason: Code tags
# 2  
Old 07-29-2010
In order for this to work you need to follow a template based on LSB init scripts. If you would like to run your script at boot, simply put the full path in the boot.local file. If you want to make it an init script, rewrite the script to follow the same preprocess header style as the other suse init scripts.

It would be simpler to put it into the boot.local. Do realize, that if your script needs parameters from a real user's environment, that you will need to source those into your script's environment.
# 3  
Old 07-30-2010
System hangs

Hi

I did wat u said that is i put the path in the boot.local file.

But when loading the system hangs there

Code:
Mounting securityfs on /sys/kernel/security done
Loading AppArmor module done
Loading AppArmor profiles done
System Boot Control: The system has been set up
Skipped features: boot.cycle
System Boot Control: Running /etc/init.d/boot.local
INN

INN is a message that i displayed in the script.

The script reads from a FIFO (pipe) file. So it hangs there waiting..

Nothing else is loaded..

How do i go abt it

Last edited by Scott; 07-31-2010 at 06:59 AM.. Reason: Code tags
# 4  
Old 07-30-2010
Please post in clear (as clear as you can) English. People here speak different native languages and it is often unclear when shortcuts or leetspeak is used.
Right now, I am unclear as to what you are asking, and I am a native English speaker.

Why is this waiting for a pipe? Your script itself may be broken. Did you do what I had said earlier and ensure your environment is set up correctly?

When you run a script after logging in, the script will take your environment. When you automate it that does not often happen.

Perhaps if you post the script (with code tags), I or somebody else may be able to help you.
# 5  
Old 07-31-2010
SYSLOG-NG messages

Hi,

Let me try to explain what the script (pasted below) actually does.

I have syslog-ng installed on a server. It logs all messages (example firewall logs) from different clients. But the log messages are stored in a database.

When i launch the script manually (via putty), it works fine, but eventually when i quit putty, the script stops.

So basically messages are sent to a pipe file namely mssql.syslog-ng.pipe, then messages from there are written to database. As you can see its in a while loop, so it waits permanently for messages. Thats the way it should be. It should run in the background actually. My problem is i dont know how to make it start whenever the server starts and it should run in the background.

What i meant by it hangs in my previous post was it was waiting messages, so it hangs there waiting and the server is not loaded completely. Its not like you are starting oracle on startup and it gets started and the server proceeds with other processes.

I dont know if its clear enough now, but im still trying to find out a solution.

Thanks

Code:
#!/bin/sh
#
# File: syslogng-mssql-pipe.sh
#
# Take input from a FIFO and run execute it as a query for
# a sqlserver database.
#


if [ -e /tmp/mssql.syslog-ng.pipe ]; then
       while [ -e /tmp/mssql.syslog-ng.pipe ]
                do
                       echo "INN"
                       isql -v MSTEST "sa" "password" </tmp/mssql.syslog-ng.pipe
                done
else
        mkfifo /tmp/mssql.syslog-ng.pipe
fi


Last edited by Scott; 07-31-2010 at 07:00 AM.. Reason: Code tags, please...
# 6  
Old 08-02-2010
Have you tried using a template to create a startup script?

The init scripts in suse allow for prerequisites such as mysql being up if that is what you wish.

Cool Solutions: Creating Custom init Scripts should help you out
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Unable to run the script on remote machine Using Expect script

Not able to execute the file in remote host using except utility I am automating the SFTP keys setp process: So i created the expect script for controlling the output of shell below is my main code: Code: #!/usr/bin/expect set fd set password close $fd set df set app close $df... (1 Reply)
Discussion started by: Manoj Bajpai
1 Replies

2. Solaris

run a service via startup script (correct me if I am wrong)

Environment Solaris 9 I have configured the Solaris9 as NTP client in which Solaris9 is syncing the time with a windows2008 R2 Server which is runing fine. Now I want that the xntpd service should start at startup. I did this via a script. Kindly correct if I did any thing wrong: 1.)Made... (9 Replies)
Discussion started by: z_haseeb
9 Replies

3. AIX

Run script with different user at the startup ..

Run script with different user at the startup .. I have created this user appuser And I have a script should to be up thru the startup by this user appuser I have defined the path of the script /user/appstart.sh in /etc/rc But at the startup starting will be by root , I’d like to keep... (6 Replies)
Discussion started by: Mr.AIX
6 Replies

4. UNIX for Dummies Questions & Answers

run a script at startup

hi, i am using rhel 5, and i wanna run a script as soon as the operating system open. How can i do this ? ( i was reading rc.d files but i could not understand exactly what are the run levels and where should i put the my shell script. my script will be : #!/bin/ksh iptables -I INPUT... (1 Reply)
Discussion started by: futi
1 Replies

5. Shell Programming and Scripting

Need to run script at startup.

Hi guys , I Need to run a specific command (pinging a particular machine). Which need to run every time i reboot the server till the time it shut down. What is the preferred way of doing this. Will it impact my system performance. My Operating system is as below. # lsb_release -a... (3 Replies)
Discussion started by: pinga123
3 Replies

6. Shell Programming and Scripting

Bash Script: Trouble unable to run

I am trying to create a menu, and the script fails on ln 38 (Files in pwd). Any idea on where the problem is?? Thanks for the help Rob #!/bin/bash # Cool Script for Weekly Assignment 2 (#3) that creates a menu to act as a ui # and run some popular commands. clear while : do ... (9 Replies)
Discussion started by: rchirico
9 Replies

7. Shell Programming and Scripting

unable to run mono app using .sh script

I did a search for this problem but couldn't find any specific answers to my problem. We have a .NET application compiled in SharpDevelop for Mono which we want to execute with a .sh shell script on Ubuntu. When we execute the script nothing happens meaning the application's visual interface... (0 Replies)
Discussion started by: JacquesB
0 Replies

8. AIX

run script at startup

I am using AIX 5.3 in P6 machine. I have a script "test.sh", when i run it manually it runs properly. I want to run the script automatically when system starts. I kept the script in /etc/rc.d/init.d and also in /etc/rc.d/rc2.d but it is not working. Do i have to write it in inittab instead of... (1 Reply)
Discussion started by: pchangba1
1 Replies

9. Shell Programming and Scripting

unable to run a script

thi is (10 Replies)
Discussion started by: angelina
10 Replies

10. Linux

Run a script during reboot/startup

Hi all, i have a script in /etc/init.d directory. -rwxr-xr-x 1 root root 26 Mar 28 16:00 myscript I need it to run when my linux reboots/startup. However is it not being executed. Do i need to put in in the rc.local directory? (1 Reply)
Discussion started by: new2ss
1 Replies
Login or Register to Ask a Question