Cron not executing my tasks.

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
glore2002

Cron not executing my tasks.

Post by glore2002 »

Hello!

I have a script (tape) which records tv from the tv tuner card using Mencoder. I saved this script in /bin and can execute it from anywhere (so, it is added to my $PATH). Its format is: tape 12 test 00:02:00 (this means recording channel 12 during 2 minutes and calling the file test). I also made the script executable.

In Ubuntu 7.04 and in Slackware it works great if I added it to cron via crontab -e or kcron. But, when I do this in Mint or Ubuntu 8.04, nothing happens. It just doesn't record anything and I don't understand why. If, instead of adding the task to cron, I run the script from the command line, it works ok. So, I am a bit confused! :?:

This is the way the script is written to cron when using kcron:

Code: Select all

0 12 13 7 7  tape 12 tvprogram 00:02:00
This means. Record at 12pm day 13 (today - Sunday). Execute the script tape which is in /bin folder. Do it during 2 minutes. Call the file tvprogram.

Any help will be appreciated.

Thanks,
Glore2002.-
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
glore2002

Re: Cron not executing my tasks.

Post by glore2002 »

Thanks for you reply Mr Blue but with quotation marks the same thing happened (just nothing being recorded). As you can see #!/bin/bash was already on top of it.

Here is my script (maybe it can be of some help too).

Code: Select all

#!/bin/bash
#
# script to encode tv using mencoder
#
# usage tape <channel#> <name> <duration>
#
CHAN="$1"
FNAME="$2"
DURATION="$3"

if [ $# -ne 3 ] 
then
echo "Usage tape <Channel> <Name> <duration>"
echo "duration = hh:mm:ss"
exit
fi

echo
echo "Taping " "$FNAME""_`date +%m%d`"
echo

mencoder tv:// -tv driver=v4l:device=/dev/video0:width=320:height=288:fps=25:norm=palnc:chanlist=us-cable:channel=$CHAN:saturation=-20:contrast=-20:audiorate=48000:immediatemode=0 -vf denoise3d -oac mp3lame -lameopts fast:preset=medium -ovc lavc -lavcopts vcodec=mpeg4:vqscale=4:aspect=4/3 -endpos $DURATION -ffourcc DX50 -o "$FNAME"_`date +%m%d`.avi -quiet
Thanks again,
Glore2002.-
glore2002

Re: Cron not executing my tasks.

Post by glore2002 »

Thanks again Mr. Blue.
I've added full path to mencoder but nothing happened again :-( This problem is driving me crazy. I don't know what to do.

Thanks again,
Glore2002.-
glore2002

Re: Cron not executing my tasks.

Post by glore2002 »

Is cron working ok for everyone except me? :-(

I've tried as root and same results: Nothing being recorded!
How do I start/restart cron in Mint?

Thanks,
Glore2002.-
chattr

Re: Cron not executing my tasks.

Post by chattr »

glore2002 wrote:
[snip]

This is the way the script is written to cron when using kcron:

Code: Select all

0 12 13 7 7  tape 12 tvprogram 00:02:00
This means. Record at 12pm day 13 (today - Sunday). Execute the script tape which is in /bin folder. Do it during 2 minutes. Call the file tvprogram.

[snip]

Reply:

It looks as if the user field is missing, so maybe cron reads ' tape ' as the user.

Try putting this in /etc/crontab :

Code: Select all


# m h dom mon dow user command

0 12 13 7 7  root /bin/tape 12 tvprogram 00:02:00

Locked

Return to “Beginner Questions”