Sponsored Content
Operating Systems Linux Why service (start|stop) can not be called from cron? Post 302468080 by hansini on Monday 1st of November 2010 02:26:33 PM
Old 11-01-2010
Why service (start|stop) can not be called from cron?

Hi,

When I googled, I came to know that I can not call the command
"service <service-name> start" from cron, insted I have to specify path to the service-name.

I wanted to know the reason.


Thanks,
Hansini
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

gzip in shell script called by cron

I'm puzzled by this one. I hope you can explain it to me. I have a ksh shell script that gzips a file among other things. This works perfectly fine when the script is manually run through a shell. However, when the same script is run through cron, it does everything correctly, but it will... (2 Replies)
Discussion started by: hbau419
2 Replies

2. Shell Programming and Scripting

How to determine the script is called from CRON?

Hello expert, What I want is to determine whether the script is called from CRON or it is executed interactively? I tried the following but no luck: #!/bin/ksh cronID=`pgrep -x cron` GPID=`ps -ef -o ppid,pid | grep " $PPID$" | awk '{print $1}'` if ; then echo I am being run... (15 Replies)
Discussion started by: wes_brooks
15 Replies

3. AIX

How to stop perl service

how to stop perl service on AIX? how to find if per service runing? (4 Replies)
Discussion started by: rainbow_bean
4 Replies

4. Solaris

How to start/stop cron jobs on live server

Hi, I am working with a company where some times i need to start/stop cron jobs on need basis. I have one option to kill cron daemon.Is it right? Please correct me. Waiting for your reply. Thanks in advance.. (2 Replies)
Discussion started by: varaprasadu
2 Replies

5. Shell Programming and Scripting

Script not working when called by cron

Hello, I have the following script which works fine when ran from the command line: #!/apps/python/2.3.4/bin/python import os import sys import time user = os.getenv("USER") string = time.strftime("%m%d%y0000 " + user, time.gmtime()) However, when I have this run by crontab, I... (4 Replies)
Discussion started by: cooldude
4 Replies

6. AIX

Q: how to start a service when system start

As topic, assume we have a service called "blahservice" and we can start it by: startsrc -s blahservice what is the best practice to run such command when system start? - directly use mkitab to add it into /etc/inittab or - drop startup scripts in /etc/rc.d/rcX.d I know they... (4 Replies)
Discussion started by: acerlinux
4 Replies

7. Shell Programming and Scripting

Cron VPN Client start/scp/stop

Hi, Anyone can help me on how my script will run on crontab, When I manually run my script, it work. But when I put in cron didn't work. #crontab schedule 00 16 * * * /home/scriptdir/myscript.sh # myscript.sh #!/bin/bash echo "mypassword"| sudo -S /etc/init.d/vpnclient_init start cd... (2 Replies)
Discussion started by: fspalero
2 Replies

8. Red Hat

Would like to stop service authentication

Hello All. I'm trying start services as an Admin user on CentOS 7. I'm able to start the service as the user but it prompts me for a password. How do I get the user to start a service without being prompted? For example; If I attempt to start the sendmail service as my user2, I receive the... (2 Replies)
Discussion started by: bbbngowc
2 Replies

9. AIX

To stop ftp service on VIO

Hi all, How can I close ftp port 21 on VIO server. Best regards, ---------- Post updated at 10:06 AM ---------- Previous update was at 08:45 AM ---------- I resoved with switch to OS mode. $ oem_setup_env (0 Replies)
Discussion started by: getrue
0 Replies

10. Solaris

Not able to start cron service in Solaris 10

Hi, This is Solaris-10 x86. I am not able to start cron service, configured in FMRI. It is in maintenance and when I clear it, it seems like calling and failing on /etc/init.d/tcs-rtm script. I am not able to figure out, why cron is calling that script, if this failure is because of that. Cron... (5 Replies)
Discussion started by: ron323232
5 Replies
svc(8)							      System Manager's Manual							    svc(8)

NAME
svc - controls services monitored by supervise(8). SYNOPSIS
svc [ -udopchaitkx ] services DESCRIPTION
services consists of any number of arguments, each argument naming a directory used by supervise(8). svc applies all the options to each service in turn. OPTIONS
-u Up. If the service is not running, start it. If the service stops, restart it. -d Down. If the service is running, send it a TERM signal and then a CONT signal. After it stops, do not restart it. -o Once. If the service is not running, start it. Do not restart it if it stops. -p Pause. Send the service a STOP signal. -c Continue. Send the service a CONT signal. -h Hangup. Send the service a HUP signal. -a Alarm. Send the service an ALRM signal. -i Interrupt. Send the service an INT signal. -t Terminate. Send the service a TERM signal. -k Kill. Send the service a KILL signal. -x Exit. supervise(8) will exit as soon as the service is down. If you use this option on a stable system, you're doing something wrong; supervise(8) is designed to run forever. SEE ALSO
supervise(8), svok(8), svstat(8), svscanboot(8), svscan(8), readproctitle(8), fghack(8), pgrphack(8), multilog(8), tai64n(8), tai64nlo- cal(8), setuidgid(8), envuidgid(8), envdir(8), softlimit(8), setlock(8) http://cr.yp.to/daemontools.html svc(8)
All times are GMT -4. The time now is 07:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy