have you tried running it with the full path to the command "service?" when you are running things in cron, you do not have a full environment unless you source one. Things that work for a user will not work in cron as a result.
Also, it is a good practice to not use the "service" command in a script. Instead, you should use the init script itself such as:
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)
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)
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)
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)
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)
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)
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)
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)
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)