[Asterisk-Users] Re Cron

Neil Cherry ncherry at comcast.net
Mon Jun 28 06:04:01 MST 2004


Samantha (Femtech) wrote:
> Hi List
> 
> Is there a cron that I con do to replace this, as the fx0 card doesnt hang up properly
> 
> phonegc:/home/samantha# asterisk -r
> Asterisk CVS-05/30/03-17:17:07, Copyright (C) 1999-2001 Linux Support Services, Inc.
> Written by Mark Spencer <markster at linux-support.net>
> =========================================================================
> Connected to Asterisk CVS-05 currently running on phonegc (pid = 15938)
> phonegc*CLI> restart now
> phonegc*CLI>
> Disconnected from Asterisk server
> phonegc:/home/samantha#

This should work. It doesn't check to see if asterisk is running and
I haven't done any erro checking.

#!/usr/bin/expect

proc sleep {timeout} {
     expect
}
set send_slow	{ 1 .05 }	;# How fast to exp_send the characters

#log_user 1			;# Keeps the user from seeing the
				;# spawned the echo back.
if [catch "spawn asterisk -r" reason ] {
   exit 1
}

set id $spawn_id

expect "CLI>" { }			 ;# wait for a DOS prompt
exp_send -s -i $id "restart now\r"	 ;# Write out the table
sleep 2
exit 0

# End of code

###############



-- 
Linux Home Automation         Neil Cherry        ncherry at comcast.net
http://home.comcast.net/~ncherry/               (Text only)
http://linuxha.sourceforge.net/                 (SourceForge)
http://hcs.sourceforge.net/                     (HCS II)



More information about the asterisk-users mailing list