HI,
I have a strange problem. A shell script that runs fine on solaris. when i ported to linux, it started hanging.
here is the core of the script
CFG_FILE=tab25.cfg
sort -t "!" -k 2 ${CFG_FILE} | egrep -v "^#|^$" | while IFS="!" read a b c
do
#echo "jobs output"
#jobs
#echo "jobs... (13 Replies)
Hello,
I am working one one script where I am using the below code which is using to connect with MKS client when I run my script manually it works effiecently i.e. it connects with MKS client but when I run it from CRON it doesn't connect.
1)Can some one tell when it is running from cron... (1 Reply)
Hi all
I have this inside a shell script (bash):
cd DIRECTORY
find . -maxdepth 1 | sed 's#./##' | /usr/bin/xargs -I '{}' chown -Rv '{}' /DIRECTORY/'{}'
All the directories in this location are named after usernames, so it simply sets the owner to that of the username of the folder.
It... (5 Replies)
Hello all,
I'm new here and have a question if you don't mind helping me. I have a script that will work if I kick if off manually but not from Cron. My cron entry is this:
05,20,35,50 * * * * /scripts/status.sh > /dev/null 2>&1
The first script (works fine) is this:
#!/bin/sh
#
#... (14 Replies)
Hello Every one,
I have a shell script which is running fine manually, but its giving me hard time when running tru cron job. :wall:.
Am using #!/usr/bin/ksh
>echo $SHELL
/usr/bin/ksh
Cron Job is as below, it execues but dosent do what i want it to do.
47 15 * * *... (1 Reply)
Hello Guys,
I have scratched my head alot on this but couldn't find clue what's wrong. Can you please help me with this? My problem is as following.
1) When I manually execute following script it runs successfully with below output.
bash-3.00# more smssend
#!/bin/bash
echo -e "<Request... (16 Replies)
Hi,
My shell script not getting called through cron job.
The same works fine when executed manually.
I tried to generate logs to find if the scripts has some errors related to path using following command- trying to execute .sh file every 5 mins:
*/5 * * * * /home/myfolder/abc.sh... (17 Replies)
Hello Gurus,
I have written small script which will start the given service if its stop .Its running fine when manually executed but its unable to run from crontab.
#!/bin/bash
SERVICENAME=rsyslog
service $SERVICENAME status > /dev/null
SYSLOGSTATUS=`echo $?`
COUNT=0
THRESHOLD=3
if ... (4 Replies)
Hi Guys,
I am executing the script called Delet.sh manually it is successfully completing the task but it is failing to run vi cron tab, I tried to pass PATH & .profile before execution but no luck, Any suggestions?
Script below
#!/usr/bin/ksh
#set -x
# Purpose : Delete folders file from... (9 Replies)
I have a script (/home/admin/run_bkup.sh) that I can run manually to kick off an executable job. I want to run it in crontab, but it doesn't work.
Here's the script:
shell=/bin/bash
today=$(date +"%m-%d-%y")
/opt/CPsuite-R77/fw1/bin/upgrade_tools/upgrade_export mgt-svr-bkup-$today << EOF
y... (18 Replies)
Discussion started by: df08388
18 Replies
LEARN ABOUT CENTOS
sv
sv(8) System Manager's Manual sv(8)NAME
sv - control and manage services monitored by runsv(8)SYNOPSIS
sv [-v] [-w sec] command services
/etc/init.d/service [-w sec] command
DESCRIPTION
The sv program reports the current status and controls the state of services monitored by the runsv(8) supervisor.
services consists of one or more arguments, each argument naming a directory service used by runsv(8). If service doesn't start with a dot
or slash and doesn't end with a slash, it is searched in the default services directory /etc/service/, otherwise relative to the current
directory.
command is one of up, down, status, once, pause, cont, hup, alarm, interrupt, 1, 2, term, kill, or exit, or start, stop, restart, shutdown,
force-stop, force-reload, force-restart, force-shutdown.
The sv program can be sym-linked to /etc/init.d/ to provide an LSB init script interface. The service to be controlled then is specified
by the base name of the ``init script''.
COMMANDS
status Report the current status of the service, and the appendant log service if available, to standard output.
up If the service is not running, start it. If the service stops, restart it.
down If the service is running, send it the TERM signal, and the CONT signal. If ./run exits, start ./finish if it exists. After it
stops, do not restart service.
once If the service is not running, start it. Do not restart it if it stops.
pause cont hup alarm interrupt quit 1 2 term kill
If the service is running, send it the STOP, CONT, HUP, ALRM, INT, QUIT, USR1, USR2, TERM, or KILL signal respectively.
exit If the service is running, send it the TERM signal, and the CONT signal. Do not restart the service. If the service is down, and
no log service exists, runsv(8) exits. If the service is down and a log service exists, send the TERM signal to the log service.
If the log service is down, runsv(8) exits. This command is ignored if it is given to an appendant log service.
sv actually looks only at the first character of these commands.
Commands compatible to LSB init script actions
status Same as status.
start Same as up, but wait up to 7 seconds for the command to take effect. Then report the status or timeout. If the script ./check
exists in the service directory, sv runs this script to check whether the service is up and available; it's considered to be avail-
able if ./check exits with 0.
stop Same as down, but wait up to 7 seconds for the service to become down. Then report the status or timeout.
reload Same as hup, and additionally report the status afterwards.
restart
Send the commands term, cont, and up to the service, and wait up to 7 seconds for the service to restart. Then report the status or
timeout. If the script ./check exists in the service directory, sv runs this script to check whether the service is up and avail-
able again; it's considered to be available if ./check exits with 0.
shutdown
Same as exit, but wait up to 7 seconds for the runsv(8) process to terminate. Then report the status or timeout.
force-stop
Same as down, but wait up to 7 seconds for the service to become down. Then report the status, and on timeout send the service the
kill command.
force-reload
Send the service the term and cont commands, and wait up to 7 seconds for the service to restart. Then report the status, and on
timeout send the service the kill command.
force-restart
Send the service the term, cont and up commands, and wait up to 7 seconds for the service to restart. Then report the status, and
on timeout send the service the kill command. If the script ./check exists in the service directory, sv runs this script to check
whether the service is up and available again; it's considered to be available if ./check exits with 0.
force-shutdown
Same as exit, but wait up to 7 seconds for the runsv(8) process to terminate. Then report the status, and on timeout send the ser-
vice the kill command.
try-restart
if the service is running, send it the term and cont commands, and wait up to 7 seconds for the service to restart. Then report the
status or timeout.
Additional Commands
check Check for the service to be in the state that's been requested. Wait up to 7 seconds for the service to reach the requested state,
then report the status or timeout. If the requested state of the service is up, and the script ./check exists in the service direc-
tory, sv runs this script to check whether the service is up and running; it's considered to be up if ./check exits with 0.
OPTIONS -v If the command is up, down, term, once, cont, or exit, then wait up to 7 seconds for the command to take effect. Then report the
status or timeout.
-w sec Override the default timeout of 7 seconds with sec seconds. This option implies -v.
ENVIRONMENT
SVDIR The environment variable $SVDIR overrides the default services directory /etc/service/.
SVWAIT The environment variable $SVWAIT overrides the default 7 seconds to wait for a command to take effect. It is overridden by the -w
option.
EXIT CODES
sv exits 0, if the command was successfully sent to all services, and, if it was told to wait, the command has taken effect to all ser-
vices.
For each service that caused an error (e.g. the directory is not controlled by a runsv(8) process, or sv timed out while waiting), sv
increases the exit code by one and exits non zero. The maximum is 99. sv exits 100 on error.
If sv is called with a base name other than sv: it exits 1 on timeout or trouble sending the command; if the command is status, it exits 3
if the service is down, and 4 if the status is unknown; it exits 2 on wrong usage, and 151 on error.
SEE ALSO runsv(8), chpst(8), svlogd(8), runsvdir(8), runsvchdir(8), runit(8), runit-init(8)
http://smarden.org/runit/
AUTHOR
Gerrit Pape <pape@smarden.org>
sv(8)