Crontab Entry Not Working

Hi,

I have the following entry in crontab.

30 17 * * * rm -rfv /backup/alfresco_bkp/alf_data_backup/`date -d '-2 days' '+%d%m%y'` {} \; >> /backup/alfresco_bkp/alf_data_backup/deletionLog.log 2>&1

This command executes properly when run manually. However, it does not work in crontab. Can some one please tell the reason and solution for this?
There some other entries as well in the crontab and are working fine.

Thank you in advance !!!


Similar Content



Problem In Executing Script Through Crontab

Hi,
I have written one script which is connecting to the the daabase and generating one CSV, it is running fine when i ran it manually though it is throwing any warning but CSV is genearting and working fine but same script when i have configured in crontab not working and giving error, kindly help.

script contents:

#!/bin/bash
sqlplus -s /nolog << EOF
CONNECT plmc/plmb@whb
@csvgenerator.sql
end;
/
EOF
-----------------------------------
Script running successfully as below, though it is giving below message but running fine

$ sh test.sh
SP2-0734: unknown command beginning "sqlplus ct..." - rest of line ignored.

Session altered.
CSV geneartaed

Same Script giving error while triggering by crontab as below

$ sqlplus: not found

Perplexing Cron Audio Problem

I'm running LinuxLite 2.0 32bit on a Dell 3000.

I have never come across anything like this and to tell you, I am stumped.

Here are the contents of my crontab file:

Code:
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
*/10 * * * * /usr/bin/arecord -t wav -f cd -d 42 /home/randy/Music/lanting$(date "+\%^b\%d\%y").wav


If I run this from the terminal, everything is fine. It properly records the audio:

Code:
/usr/bin/arecord -t wav -f cd -d 42 /home/randy/Music/lanting$(date "+\%^b\%d\%y").wav

If I run this as it is shown in my crontab file, it records but there is no audio recorded.:


Code:
*/10 * * * * /usr/bin/arecord -t wav -f cd -d 42 /home/randy/Music/lanting$(date "+\%^b\%d\%y").wav

What could be causing this? I tried different cron settings for example 15 14 * * 2

This recorded at 2:15pm on Tuesday (today) but no audio. Yet if I run the code as mentioned above, from the terminal without the cron settings, the recording is fine.

Any ideas what I should do?

Rsync Cronjob Question

hey guys, sorry for asking a dumb question, but some of the terminology online is not grasping me well, and still leaving me confused


in crontab -e

I have a shell script that contains

rsync /home/willc86 willc86@server02:/home/willc86/backup

the script works good by itself, however i have to put in a password which I understand. i know crontab works, because i used rsync script in the local machine. I am just having problems trying to sync it to another server

how do i get this rsync going in crontab to back it up to another server.

Puppet Crontab

Hi Guru,

Please help me on how to setup crontab in puppet client. sample
every 30mins the command "puppet agent --server puppet-server -t" will execute.

Thank you in advance..

Script Automatic Send Email Using Crontab

Hello,

I have server but it all hardening.i can't install mailx and sendmail. How could i do script to automatic send email to my mailbox using crontab?

any idea guy.

Thanks for the help.

Samhan

Cron Ignoring Changes Made In File

Hi,

i have a small problem on my system... I recently wrote a small bash script and added it via crontab -u root -e and it's executed as it should.
Then a few days after i did edit my bash script, but once it is run by cron it doesn't reflect the changes i made to the script. I did manually restart crond, tryed sync, moved my script, renamed it even rstart the server - no success.
If i run my script manually it returns me the expected output.
part of my script (/root/sd.sh):
Code:
#!/bin/sh

echo -n "Checking Raid... "
RAID=`tw-cli /c0/u0 show status | cut -c17-31 | grep -ci OK`
RAIDSTATUS=`tw-cli /c0/u0 show status | head -n1 | cut -c17-31`
if [ $RAID -eq 0 ]; then
  VERIFYING=`tw-cli /c0/u0 show status | cut -c17-31 | grep -ci VERIFYING`
  REBUILDING=`tw-cli /c0/u0 show status | cut -c17-31 | grep -ci REBUILDING`
  if [ $VERIFYING -eq 1 ]; then
    CURRENTSTATUS=`tw-cli /c0/u0 show verifystatus | head -n1 | cut -c46-49`
  fi
  if [ $REBUILDING -eq 1 ]; then
    CURRENTSTATUS=`tw-cli /c0/u0 show rebuildstatus | head -n1 | cut -c47-50`
  fi
  echo "Raid is busy (Raid $RAIDSTATUS$CURRENTSTATUS)"
  exit 1
fi
echo "Raid is idle (Raid $RAIDSTATUS)"

echo -n "Checking for logged in Users... "
USERS=`who | wc -l`
if [ $USERS -gt 0 ]; then
  echo "Users online"
  exit 1
fi
echo "None logged in"

crontab -l :
Code:
root@monster:~# crontab -l
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
*/10 * * * * /root/sd.sh | logger
*/30 * * * * /root/dropbox.sh > /dev/null

syslog:
Code:
Mar 21 09:10:01 monster /USR/SBIN/CRON[3998]: (root) CMD (/root/sd.sh | logger)
Mar 21 09:10:01 monster logger: Checking Raid... Raid is busy (Raid )
Mar 21 09:17:01 monster /USR/SBIN/CRON[4045]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Mar 21 09:20:01 monster /USR/SBIN/CRON[4105]: (root) CMD (/root/sd.sh | logger)
Mar 21 09:20:01 monster logger: Checking Raid... Raid is busy (Raid )
Mar 21 09:30:01 monster /USR/SBIN/CRON[4266]: (root) CMD (/root/sd.sh | logger)
Mar 21 09:30:01 monster /USR/SBIN/CRON[4265]: (root) CMD (/root/dropbox.sh > /dev/null)
Mar 21 09:30:01 monster logger: Checking Raid... Raid is busy (Raid )

when i run sh /root/sd.sh
Code:
root@monster:~# sh /root/sd.sh
Checking Raid... Raid is idle (Raid OK)
Checking for logged in Users... Users online
root@monster:~#

Any ideas why? - any help or thoughts appreciated

regards
Pat

Crontab Queries

Hi,

Is it possible to schedule a cron job runs every quarter of the year? If so, how to go about it?

Thanks in advance.

Prevent Account From Being Locked Out After X Number Of Attempts

Hi all,

I have several crontab entries run as oracle user. I need to prevent oracle user from being locked when the max failed login is reached. Is there a way to prevent it from being locked even when the server is hardened? OS is SunOs.

Thanks!

Automating Script To Run Every Minute Through Other Manually Created User Using Crond

Hy All,

I have two nodes running RHEL 6.4 which are in cluster. I have clustered httpd service. Now I have certain application suppose X which reside in SAN partition. Now my job is to only automate this script to run by analyzing httpd status. I have successfully created the script apptrigger.sh whose content is given below,

-bash-4.1$ cat apptrigger.sh
a=0
b=0
c=0
d=0
a="service httpd status"
b=`eval $a`
##### CHECKING WHETHER HTTPD SERVICE IS RUNNING OR NOT #####
if [ "$b" != "httpd is stopped" ]; then
c="bash /switchapp/switch/ezlinkenterprise/bin/ezlink-cluster.sh status"
d=`eval $c`
##### CHECKING WHETHER EZ IS RUNNING OR NOT #####
if [ "$d" != "EzTaskMgr is Running" ]; then
ezstart
fi
fi

I have created this script in say test user. Now when I put this script to automate or run every minute through test user and defined its value in crontab -e of test user whose content is as shown below
$crontab -l
* * * * * /bin/bash /home/test/apptrigger.sh

but this script is running as root user so I cannot get the o/p
I think some environment variable need to be set. Anyone can guide me with this step? Thanks for your views and suggestion.

Path To My Script

Stupid question, i know, but what is the correct path to run a script from root that is located in /home?
screen -dmS bungee /home/sh bungeestart.sh >> /home/spigot.out
I have this but is doesn't work....
This is done via crontab at reboot...