I copied and pasted the "/etc/init.d/skeleton" file to a new one so I could create my own init script for a program.
Basically the ONLY edit I made to the skeleton "template" so far was to search and replace "FOO" with "snort".
*NOTE: I know there are a bunch of snort init scripts out there, but they weren't working the way I wanted, so I wanted to play around a bit with the init script because I had just recently found out what the 'skeleton' file was for...
But anyway, when I run the script with 'status' as the only argument to the script it seems to execute the init script twice. i.e. It prints out the status twice to the screen...
Like this:
Code:
# /etc/init.d/snort_skeleton status
Checking for service snort running
Checking for service snort running
And if I change the line in the script for status from:
I get this as the output, which is telling me it's executing twice for some reason...
Code:
Checking for service snort OUTPUT = ' '
running
Checking for service snort OUTPUT = ' '
running
Any idea why this would execute twice? Below is the skeleton file, I removed MOST of the comment lines because there are a TON... Filename: snort_skeleton Command--> /etc/init.d/snort_skeleton status
Code:
#!/bin/sh
# Check for missing binaries (stale symlinks should not happen)
# Note: Special treatment of stop for LSB conformance
snort_BIN=/usr/sbin/snort
test -x $snort_BIN || { echo "$snort_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
# Check for existence of needed config file and read it
snort_CONFIG=/etc/sysconfig/snort
test -r $snort_CONFIG || { echo "$snort_CONFIG not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
# Read config
. $snort_CONFIG
. /etc/rc.status
# Reset status of this service
rc_reset
case "$1" in
start)
echo -n "Starting snort "
/sbin/startproc $snort_BIN
# Remember status and be verbose
rc_status -v
;;
stop)
echo -n "Shutting down snort "
/sbin/killproc $snort_BIN
# Remember status and be verbose
rc_status -v
;;
try-restart|condrestart)
if test "$1" = "condrestart"; then
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
fi
$0 status
if test $? = 0; then
$0 restart
else
rc_reset # Not running is not a failure.
fi
# Remember status and be quiet
rc_status
;;
restart)
$0 stop
$0 start
# Remember status and be quiet
rc_status
;;
force-reload)
echo -n "Reload service snort "
## if it supports it:
/sbin/killproc -HUP $snort_BIN
#touch /var/run/snort.pid
rc_status -v
## Otherwise:
#$0 try-restart
#rc_status
;;
reload)
# If it supports signaling:
echo -n "Reload service snort "
/sbin/killproc -HUP $snort_BIN
#touch /var/run/snort.pid
rc_status -v
## Otherwise if it does not support reload:
#rc_failed 3
#rc_status -v
;;
status)
echo -n "Checking for service snort "
/sbin/checkproc $snort_BIN
rc_status -v
;;
probe)
test /etc/snort/snort.conf -nt /var/run/snort.pid && echo reload
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
exit 1
;;
esac
rc_exit
If anyone has ANY ideas why this would be happening please feel free...
Any thoughts or suggestions would be greatly appreciated.
Thanks in Advance,
Matt
--------------------------------------------------------------------------------------------------------------------------------------------------- UPDATE: I added a simple echo statement to the very start of the script on the 1st line after the shebang line: echo "FIRST LINE:"
Then, I run the script again manually from the command line, with: ./snort_skeleton status
And the Output is:
Code:
FIRST LINE:
FIRST LINE:
Checking for service snort running
Checking for service snort running
Just thought that was VERY strange... Any ideas??
Thanks Again,
Matt
---------- Post updated at 04:34 PM ---------- Previous update was at 02:24 PM ----------
Sorry, didn't want to just keep Update/Editing my original post, but I just found something else that seems pretty strange...
If I execute the script and I include a 2nd argument on the cli, NO MATTER WHAT THE ARG IS, it only runs once. I can make the
2nd argument be anything. From another init option like, start|stop|restart|etc... to "foo" to a single number, it ONLY runs once... How
strange is that??
Example:
Code:
# ./snort_skeleton status 1
Checking for service snort running
# ./snort_skeleton status foo
Checking for service snort running
# ./snort_skeleton status start
Checking for service snort running
But if I include "status" as the ONLY option I get:
Code:
# ./snort_skeleton status
Checking for service snort running
Checking for service snort running
Thought that could possibly help. I do see in the script they use "$@" but that is the only reference I see to more then just the 1st
CLI Option, *i.e. "$2" is not used in the script anywhere...
I apologize, the script that had the "$@" was the "skeleton.compat" file, not the file called just skeleton. Which is what
I'm using.
But even so, without the $@, it is still looking as though it is executing twice. I thought it was very strange that if you include a
second command line option, it only prints the output once.
But, you'd think if it was simply executing twice, that it would write MY output line then the status. Then again in the same output
my output again then the status. Not both of my output lines then both of the status lines, which is what it is doing now.
For Example: If I added the line "echo 'Hello' " to the start of the script... It prints:
Code:
Hello
Hello
Checking for service snort Not Running
Checking for service snort Not Running
Strange...
Thanks again for the reply.
Thanks,
Matt
---------- Post updated at 04:25 PM ---------- Previous update was at 11:00 AM ----------
Ok, so I added some more echo lines to the script in different locations just to see how it would print out, and if I could see
where it was beginning to execute all over again, and I got some interesting output...
If I add the "echo(s)" like in the code below:
Code:
#!/bin/sh
echo -ne "1st ECHO:\n"
# Check for missing binaries (stale symlinks should not happen)
# *Note: Special treatment of stop for LSB conformance
snort_BIN=/usr/sbin/snort
test -x $snort_BIN || { echo "$snort_BIN not installed";
if [ "$1" = "stop" ]
then
exit 0
else
exit 5
fi; }
echo -ne " 2nd ECHO:\n"
# Check for existence of needed config file and read it
snort_CONFIG=/etc/sysconfig/snort
test -r $snort_CONFIG || { echo "$snort_CONFIG not existing";
if [ "$1" = "stop" ]
then
exit 0
else
exit 6
fi; }
echo -ne " 3rd ECHO:\n"
# Read config
. $snort_CONFIG
echo -ne " 4th ECHO:\n"
. /etc/rc.status
echo -ne " 5th ECHO:\n"
# Reset status of this service
rc_reset
echo -ne " 6th ECHO:\n"
case "$1" in
start)
echo -ne " 7th ECHO in 'START)':\n"
echo -n "Starting snort "
## Start daemon with startproc(8). If this fails
## the return value is set appropriately by startproc.
/sbin/startproc $snort_BIN
# Remember status and be verbose
rc_status -v
;;
stop)
echo -ne " 7th ECHO in 'STOP)':\n"
echo -n "Shutting down snort "
## Stop daemon with killproc(8) and if this fails
## killproc sets the return value according to LSB.
/sbin/killproc $snort_BIN
# Remember status and be verbose
rc_status -v
;;
try-restart|condrestart)
echo -ne " 7th ECHO in 'TRY-RESTART|CONDRESTART)':\n"
if test "$1" = "condrestart"; then
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
fi
$0 status
if test $? = 0; then
$0 restart
else
rc_reset # Not running is not a failure.
fi
# Remember status and be quiet
rc_status
;;
restart)
echo -ne " 7th ECHO in 'RESTART)':\n"
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
# Remember status and be quiet
rc_status
;;
force-reload)
echo -ne " 7th ECHO in 'FORCE-RELOAD)':\n"
echo -n "Reload service snort "
## if it supports it:
/sbin/killproc -HUP $snort_BIN
#touch /var/run/snort.pid
rc_status -v
;;
reload)
echo -ne " 7th ECHO in 'RELOAD)':\n"
# If it supports signaling:
echo -n "Reload service snort "
/sbin/killproc -HUP $snort_BIN
rc_status -v
;;
status)
echo -ne " 7th ECHO in 'STATUS)':\n"
echo -n "Checking for service snort "
appl.)
# NOTE: checkproc returns LSB compliant status values.
/sbin/checkproc $snort_BIN
# NOTE: rc_status knows that we called this init script with
# "status" option and adapts its messages accordingly.
rc_status -v
;;
probe)
echo -ne " 7th ECHO in 'PROBE)':\n"
## Optional: Probe for the necessity of a reload, print out the
## argument to this init script which is required for a reload.
## Note: probe is not (yet) part of LSB (as of 1.9)
test /etc/snort/snort.conf -nt /var/run/snort.pid && echo reload
;;
*)
echo -ne " 7th ECHO in '*)':\n"
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"
exit 1
;;
esac
rc_exit
So if I added the echo commands like in the code above, I now get:
Code:
snortIDS:/etc/init.d # ./snort_skeleton status
1st LINE:
2nd LINE:
3rd LINE:
4th LINE:
1st LINE:
2nd LINE:
3rd LINE:
4th LINE:
5th LINE:
6th LINE:
7th LINE in 'STATUS)':
Checking for service snort Not Running
5th LINE:
6th LINE:
7th LINE in 'STATUS)':
Checking for service snort Not Running
############################################################
snortIDS:/etc/init.d # ./snort_skeleton status
1st LINE:
2nd LINE:
3rd LINE:
4th LINE:
5th LINE:
6th LINE:
7th LINE in '*)':
Usage: ./snort_skeleton {start|stop|status|try-restart|restart|force-reload|reload|probe}
############################################################
snortIDS:/etc/init.d # ./snort_skeleton status 1
1st LINE:
2nd LINE:
3rd LINE:
4th LINE:
5th LINE:
6th LINE:
7th LINE in 'STATUS)':
Checking for service snort Not Running
As you can see from the 3 different commands I issued I get different output each time... It seems like right about where I am
sourcing the ". /etc/rc.status" file is where it is starting to repeat... Weird.
# /etc/rc.status
# vim: syntax=sh
# Definition of boot script return messages
#
# The bootscripts should use the variables rc_done and rc_failed to
# report whether they failed or succeeded. See /etc/init.d/skeleton for
# an example how the shell functions rc_status and rc_reset are used.
#
# These functions make use of the variables rc_done and rc_failed;
# rc_done_up and rc_failed_up are the same as rc_done and rc_failed
# but contain a terminal code to move up one line before the output
# of the actual string. (This is particularly useful when the script
# starts a daemon which produces user output with a newline character)
#
# The variable rc_reset is used by the master resource control script
# /etc/init.d/rc to turn off all attributes and switch to the standard
# character set.
#
# \033 ascii ESCape
# \033[<NUM>G move to column <NUM> (linux console, xterm, not vt100)
# \033[<NUM>C move <NUM> columns forward but only upto last column
# \033[<NUM>D move <NUM> columns backward but only upto first column
# \033[<NUM>A move <NUM> rows up
# \033[<NUM>B move <NUM> rows down
# \033[1m switch on bold
# \033[31m switch on red
# \033[32m switch on green
# \033[33m switch on yellow
# \033[m switch off color/bold
# \017 exit alternate mode (xterm, vt100, linux console)
# \033[10m exit alternate mode (linux console)
# \015 carriage return (without newline)
#
# Check if the service is used under systemd but not started with
if test -z "$SYSTEMD_NO_WRAP" && /bin/mountpoint -q /sys/fs/cgroup/systemd > /dev/null 2>&1 ; then
if test $PPID -ne 1 -a $# -eq 1 ; then
_rc_base=
case "$0" in
/etc/init.d/boot.*)
_rc_base=${0##*/boot.} ;;
/etc/init.d/*|/etc/rc.d/*)
_rc_base=${0##*/} ;;
*/rc*)
if test -L "$0"; then
_rc_base=`readlink "$0"`
_rc_base=${_rc_base##*/}
case "$_rc_base" in
boot.*) _rc_base=${_rc_base#boot.}
esac
else
_rc_base=${0##*/rc}
fi
;;
esac
case "$1" in
status) SYSTEMD_NO_WRAP=1 "$0" "$1" ;;
start|stop|reload|restart|try-restart|force-reload) echo "redirecting to systemctl ${SYSTEMCTL_OPTIONS} $1 ${_rc_base}" 1>&2 ;;
*) unset _rc_base ;;
esac
if test -n "$_rc_base" -a -x /bin/systemctl ; then
exec /bin/systemctl ${SYSTEMCTL_OPTIONS} $1 "${_rc_base}"
fi
unset _rc_base
fi
if test -z "$REDIRECT" -a -x /sbin/showconsole ; then
REDIRECT="$(/sbin/showconsole 2>/dev/null)"
test -z "$CONSOLE" && CONSOLE=/dev/console
export REDIRECT CONSOLE
fi
fi
# Do _not_ be fooled by non POSIX locale
LC_ALL=POSIX
export LC_ALL
# Seek for terminal size and, if needed, set default size
rc_lc () {
if test -n "$REDIRECT" ; then
set -- $(stty size < "$REDIRECT" 2> /dev/null || echo 0 0)
else
set -- $(stty size 2> /dev/null || echo 0 0)
fi
LINES=$1
COLUMNS=$2
if test $LINES -eq 0 -o $COLUMNS -eq 0; then
LINES=24
COLUMNS=80
TERM=dumb
fi
}
trap 'rc_lc' SIGWINCH
test -n "$COLUMNS" -a -n "$LINES" || rc_lc
export LINES COLUMNS
# Make sure we have /sbin and /usr/sbin in PATH
case ":$PATH:" in
*:/sbin:*)
;;
*)
PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH
export PATH
;;
esac
if test -t 1 -a "$TERM" != "raw" -a "$TERM" != "dumb"; then
esc=`echo -en "\033"`
extd="${esc}[1m"
warn="${esc}[1;31m"
done="${esc}[1;32m"
attn="${esc}[1;33m"
norm=`echo -en "${esc}[m\017"`
stat=`echo -en "\015${esc}[${COLUMNS}C${esc}[10D"`
rc_done="${stat}${done}done${norm}"
rc_running="${stat}${done}running${norm}"
rc_failed="${stat}${warn}failed${norm}"
rc_missed="${stat}${warn}missing${norm}"
rc_skipped="${stat}${attn}skipped${norm}"
rc_dead="${stat}${warn}dead${norm}"
rc_unused="${stat}${extd}unused${norm}"
rc_unknown="${stat}${attn}unknown${norm}"
rc_done_up="${esc}[1A${rc_done}"
rc_failed_up="${esc}[1A${rc_failed}"
rc_reset="${norm}${esc}[?25h"
rc_save="${esc}7${esc}[?25l"
rc_restore="${esc}8${esc}[?25h"
rc_cuu () { test $1 -eq 0 && return; echo -en "\033[${1}A"; }
rc_cud () { test $1 -eq 0 && return; echo -en "\033[${1}B"; }
rc_timer_on () {
# Draw seconds of running timout to column.
# Two arguments: timeout in seconds and offset
local n=$1
local c=$2
(trap "exit 0" SIGTERM
while test $((n--)) -gt 0; do
sleep 1;
if test $n -gt 9 ; then
echo -en "\015${esc}[${c}C(${n}s) "
else
echo -en "\015${esc}[${c}C( ${n}s) "
fi
done) & _rc_timer_pid=$!
}
rc_timer_off () {
if test -n "$_rc_timer_pid" ; then
kill -TERM $_rc_timer_pid > /dev/null 2>&1
fi
unset _rc_timer_pid
}
else
esc=""
extd=""
warn=""
done=""
attn=""
norm=""
stat=""
rc_done="..done"
rc_running="..running"
rc_failed="..failed"
rc_missed="..missing"
rc_skipped="..skipped"
rc_dead="..dead"
rc_unused="..unused"
rc_unknown="..unknown"
rc_done_up="${rc_done}"
rc_failed_up="${rc_failed}"
rc_reset=""
rc_save=""
rc_restore=""
rc_cuu () { return; }
rc_cud () { return; }
rc_timer_on () { return; }
rc_timer_off () { return; }
fi
_rc_service=${0##*/[SK][0-9][0-9]}
_rc_status=0
_rc_status_all=0
_rc_todo=$1
rc_check ()
{
_rc_status_ret=$?
test $_rc_status_ret -eq 0 || _rc_status=$_rc_status_ret
test $_rc_status -eq 0 || _rc_status_all=$_rc_status
return $_rc_status_ret
}
rc_reset ()
{
_rc_status=0
_rc_status_all=0
rc_check
return 0
}
if test "$_rc_todo" = "status" ; then
rc_status ()
{
rc_check
_rc_status_ret=$_rc_status
local i
for i ; do
case "$i" in
-v|-v[1-9]|-v[1-9][0-9])
local vrt=""
local out=1
local opt="en"
test -n "${i#-v}" && vrt=${esc:+"${esc}[${i#-v}A"} || opt="e"
case "$_rc_status" in
0) vrt="$vrt$rc_running"; ;; # service running
1) vrt="$vrt$rc_dead" ; out=2 ;; # service dead (but has pid file)
2) vrt="$vrt$rc_dead" ; out=2 ;; # service dead (but has lock file)
3) vrt="$vrt$rc_unused" ; ;; # service not running
4) vrt="$vrt$rc_unknown"; ;; # status is unknown
esac
echo -$opt "$rc_save$vrt$rc_restore" 1>&$out
# reset _rc_status to 0 after verbose case
_rc_status=0 ;;
-r) rc_reset ;;
-s) echo -e "$rc_skipped" ; rc_failed 3 ;;
-u) echo -e "$rc_unused" ; rc_failed 3 ;;
*) echo "rc_status: Usage: [-v[<num>] [-r]|-s|-u]" 1>&2 ; return 0 ;;
esac
done
return $_rc_status_ret
}
elif test -n "$_rc_todo" ; then
rc_status ()
{
rc_check
test "$_rc_status" -gt 7 && rc_failed 1
_rc_status_ret=$_rc_status
case "$_rc_todo" in
stop)
# program is not running which
# is success if we stop service
test "$_rc_status" -eq 7 && rc_failed 0 ;;
esac
local i
for i ; do
case "$i" in
-v|-v[1-9]|-v[1-9][0-9])
local vrt=""
local out=1
local opt="en"
test -n "${i#-v}" && vrt=${esc:+"${esc}[${i#-v}A"} || opt="e"
case "$_rc_status" in
0) vrt="$vrt$rc_done" ; ;; # success
1) vrt="$vrt$rc_failed" ; out=2 ;; # generic or unspecified error
2) vrt="$vrt$rc_failed" ; out=2 ;; # invalid or excess args
3) vrt="$vrt$rc_missed" ; out=2 ;; # unimplemented feature
4) vrt="$vrt$rc_failed" ; out=2 ;; # insufficient privilege
5) vrt="$vrt$rc_skipped"; out=2 ;; # program is not installed
6) vrt="$vrt$rc_unused" ; out=2 ;; # program is not configured
7) vrt="$vrt$rc_failed" ; out=2 ;; # program is not running
*) vrt="$vrt$rc_failed" ; out=2 ;; # unknown (maybe used in future)
esac
echo -$opt "$rc_save$vrt$rc_restore" 1>&$out
# reset _rc_status to 0 after verbose case
_rc_status=0 ;;
-r) rc_reset ;;
-s) echo -e "$rc_skipped" 1>&2 ; rc_failed 5 ;;
-u) echo -e "$rc_unused" 1>&2 ; rc_failed 6 ;;
*) echo "rc_status: Usage: [-v[<num>] [-r]|-s|-u]" 1>&2 ; return 0 ;;
esac
done
return $_rc_status_ret
}
else
rc_status ()
{
rc_check
_rc_status_ret=$_rc_status
local i
for i ; do
case "$i" in
-v|-v[1-9]|-v[1-9][0-9])
local vrt=""
local out=1
local opt="en"
test -n "${i#-v}" && vrt=${esc:+"${esc}[${i#-v}A"} || opt="e"
case "$_rc_status" in
0) vrt="$vrt$rc_done" ; ;; # success
*) vrt="$vrt$rc_failed"; out=2 ;; # failed
esac
echo -$opt "$rc_save$vrt$rc_restore" 1>&$out
# reset _rc_status to 0 after verbose case
_rc_status=0 ;;
-r) rc_reset ;;
-s) echo -e "$rc_skipped" ; return 0 ;;
-u) echo -e "$rc_unused" ; return 0 ;;
*) echo "rc_status: Usage: [-v[<num>] [-r]|-s|-u]" 1>&2 ; return 0 ;;
esac
done
return $_rc_status_ret
}
fi
rc_failed ()
{
rc_reset
case "$1" in
[0-7]) _rc_status=$1 ;;
"") _rc_status=1
esac
rc_check
return $_rc_status
}
rc_exit ()
{
exit $_rc_status_all
}
rc_confirm()
{
local timeout="30"
local answer=""
local ret=0
case "$1" in
-t) timeout=$2; shift 2 ;;
esac
local message="$@, (Y)es/(N)o/(C)ontinue? [y] "
: ${REDIRECT:=/dev/tty}
while true ; do
read -t ${timeout} -n 1 -p "${message}" answer < $REDIRECT > $REDIRECT 2>&1
case "$answer" in
[yY]|"") ret=0; break ;;
[nN]) ret=1; break ;;
[cC]) ret=2; break ;;
*) echo; continue
esac
done
echo
return $ret
}
rc_active ()
{
local link
for link in /etc/init.d/*.d/S[0-9][0-9]${1} ; do
test -e $link || break
return 0
done
return 1
}
rc_splash()
{
return 0
}
# Wait between last SIGTERM and the next SIGKILL
# any argument specify a *path* of a process which
# process identity should *not* be checked.
rc_wait()
{
local -i etime=$SECONDS
if test -f /fastboot ; then
let etime+=2
else
let etime+=6
fi
local -i pid
local -i ppid=$$
local comm state rest
local parent_processes="$ppid"
while test $ppid -gt 1; do
read -t 1 pid comm state ppid rest < /proc/$ppid/stat
parent_processes="${parent_processes:+$parent_processes:}${ppid}"
done
for comm ; do
test -s $comm || continue
ppid="$(/sbin/pidofproc $comm 2> /dev/null)" || continue
parent_processes="${parent_processes:+$parent_processes:}${ppid}"
done
unset comm state ppid rest
local -i busy
while test $SECONDS -lt $etime; do
let busy=0
for proc in /proc/[0-9]* ; do
test -e $proc/exe || continue
let pid=${proc##*/}
case ":${parent_processes}:" in
*:${pid}:*) continue
esac
let busy=pid
break
done
test $busy -ne 0 || return 0
usleep 500000
done
}
rc_runlevel()
{
test -z "$RUNLEVEL" || return
set -- $(/sbin/runlevel)
PREVLEVEL=$1
RUNLEVEL=$2
export PREVLEVEL RUNLEVEL
}
cmdline=""
rc_cmdline()
{
local arg cmd key val
test -e /proc/cmdline || mount -nt proc proc /proc
test -n "$cmdline" || read -t 2 cmdline < /proc/cmdline
for arg; do
for cmd in $cmdline ; do
key="${cmd%%=*}"
key="${key//-/_}"
case "${key}" in
$arg)
case "$cmd" in
*=*) val="${cmd#*=}" ;;
*) val=yes
esac
echo $key=$val
return 0
esac
done
done
return 1
}
I see a couple of default for statments in there. Like this:
Code:
rc_status ()
{
rc_check
_rc_status_ret=$_rc_status
local i
for i ; do
case "$i" in
That "for i" is going to loop over all of the positional parameters. You are on the right track using echo statement to figure out where it loops. I would continue with that in rc.status. However... rc.status is possibly in use by other scripts so make a temparary copy and change your parent script to invoke the temporary copy. Then add echo statements to your temporary copy to shed more light. I would be generous with my echo statements in the vicinity of those "for" statements I mentioned. Those are loops that will behave differently when you supply a superfluous argument.
This is what I did:
1. I wrote a simple init.d script (myscript.sh)
2. I placed it under /etc/init.d (where many other default scripts already are)
3. Set the perms to 755
4. Run: update-rc.d myscript.sh defaults
I can run it perfectly by doing:
/etc/init.d/myscript.sh start... (2 Replies)
I have bash shell script which is internally calling python script.I would like to know how long python is taking to execute.I am not allowed to do changes in python script.Please note i need to know execution time of python script which is getting executed inside shell .I need to store execution... (2 Replies)
Hi All,
I'm trying to build a start up script, wud be gr8 if any one can explain what the below field means and how can i check it for my script.
DAEMON_PATH="/home/wes/Development/projects/myapp"
DAEMON=myapp
DAEMONOPTS="-my opts"
NAME=myapp
DESC="My daemon description"... (4 Replies)
Hi,
I am having a shell script which has a while loop as shown below.
while
do
sleep 60
done
I am executing this script from Informatica ETL tool command task from where we can execute UNIX commands/scripts. When i do that, i am seeing 2 processes getting started for one script... (2 Replies)
Hi
Script not getting executed via cron but executes successfully when executed manually. Please assist
cbspsap01(appuser) /app/scripts > cat restart.sh
#!/bin/ksh
cd /app/bin
date >>logfile.out
echo "Restart has been started....." >>logfile.out
date >>logfile.out
initfnsw -y restart... (3 Replies)
I encountered a problem on one of our database servers.
OS: CentOS 5.5 final
Kernel: 2.6.18-238.5.1.el5.028stab085.2 (OpenVZ kernel)
We wrote some DB-Start/Stop-scripts ("/db2/admin/scripts_dba/start_services.ksh" and ".../stop_services.ksh") to start the database instances. (Database... (1 Reply)
Hi,
I am experiencing a weird thing on my SUNFIRE machine with Solaris 9 OS.
When I do init 0 to shutdown the machine to go to ok prompt, what it did was shutdown and reboot like an init 6 command do. I did check the corresponding rc scripts that were involved with init 0 and compared with rc... (2 Replies)
Dear all,
I typed in init 1 on my redhat box as root and according to wikipedia (http://en.wikipedia.org/wiki/Runlevel):
1 Single-User Mode Does not configure network interfaces, start daemons, or allow non-root logins
So now I can't connect back to it. How do I change the init back to 3?... (8 Replies)
Dear all
I would like to capture who executed a script to a script's variable (i.e. testing.sh), so I can save it to a log file.
testing.sh
#! bin/ksh
user=`<< code here >>` // get the info below in RED color
<<main logic>>
echo "$user execute testing.sh on `date`" >> testing.log
... (2 Replies)
Hi Expert,
I have encountered some problem with my SUN system. Everytime when i issue command #init 6 OR #init 0 it just logout and prompt for login again instead of rebooting the server when run init 6 and system shutdown when run init 0..
I can only reboot the system using reboot ... Was... (6 Replies)