Cron job for restarting asterisk

Hello everyone,

I am new to this post and somewhat to asterisk so please bear with me.

Like to know how I can setup a cron job to restart asterisk daily (or every other day)

I have Ubuntu:

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 11.10
Release: 11.10
Codename: oneiric

this does not work for me

0 5 * * * /etc/init.d/asterisk -r -x “restart gracefully” >/dev/null 2>&1

thanks in advance,

I think you better use /usr/sbin/asterisk binary instead of the /etc/init.d/asterisk script

Why do you want it to restart it? That is not the normal behaviour.

thanks for the answer been suggested that if channels lock up best way is to restart the asterisk

pbx.c: Unable to register extension ‘424242’, priority 1 in ‘conference’, already in use

it says already in use but it is not in use.

If something has locked up, restart gracefully won’t help at all! Even restart now may get stuck on a lock. You need to kill Asterisk process and then restart it, e.g. service asterisk restart on a standard CentOS install.

thanks for your support i think that is the trick.