'cpmv' instead of 'cp' Re: [asterisk-users] [tip]semicolon trouble: System($(sleep 4; cp 1.call out)) not working, but System($( sleep 4 cp 1.call out)) ; )

2006-07-08 Thread Robert Michel
Salve Tzafrir, *! On Sat, 08 Jul 2006, Tzafrir Cohen wrote: Sytem($( sleep 4 cp 1.call /var/spool/asterisk/outgoing) ) However you should not copy to the outgoing queue. You should mv a file there. Right, I remember that a good friend of mine talked about the disadvantages of the

Re: 'cpmv' instead of 'cp' Re: [asterisk-users] [tip]semicolon trouble:

2006-07-08 Thread Doug Lytle
Robert Michel wrote: Salve Tzafrir, *! On Sat, 08 Jul 2006, Tzafrir Cohen wrote: Sytem($( sleep 4 cp 1.call /var/spool/asterisk/outgoing) ) However you should not copy to the outgoing queue. You should mv a file there. Right, I remember that a good friend of mine

Re: 'cpmv' instead of 'cp' Re: [asterisk-users] [tip]semicolon trouble: System($(sleep 4; cp 1.call out)) not working, but System($( sleep 4 cp 1.call out)) ; )

2006-07-08 Thread Robert Michel
Salve *! Small improvement, I think it would be a good idea to use $RANDOM for the temporary file name - you could never known what it is running at the same time, especialy in case that someone would use this script not for asterisk callfiles - remember my script is just a try ;) #!/bin/bash #

Re: 'cpmv' instead of 'cp' Re: [asterisk-users] [tip]semicolon trouble: System($(sleep 4; cp 1.call out)) not working, but System($( sleep 4 cp 1.call out)) ; )

2006-07-08 Thread Tzafrir Cohen
On Sat, Jul 08, 2006 at 05:20:31PM +0200, Robert Michel wrote: Salve *! Small improvement, I think it would be a good idea to use $RANDOM for the temporary file name - you could never known what it is running at the same time, especialy in case that someone would use this script not for

Re: 'cpmv' instead of 'cp' Re: [asterisk-users] [tip]semicolon trouble:

2006-07-08 Thread Maxim Vexler
On 7/8/06, Doug Lytle [EMAIL PROTECTED] wrote: Robert Michel wrote: Salve Tzafrir, *! On Sat, 08 Jul 2006, Tzafrir Cohen wrote: Sytem($( sleep 4 cp 1.call /var/spool/asterisk/outgoing) ) However you should not copy to the outgoing queue. You should mv a file there. Right, I

Re: 'cpmv' instead of 'cp' Re: [asterisk-users] [tip]semicolon trouble: System($(sleep 4; cp 1.call out)) not working, but System($( sleep 4 cp 1.call out)) ; )

2006-07-08 Thread Robert Michel
Salve Tzafrir! On Sat, 08 Jul 2006, Tzafrir Cohen wrote: To simplify error handling: set -e tmpfile=`mktemp` Note that the temp file has to be in the sme filesystem as the asterisk spool It would be more performant when it is the same filesystem, but it should also work when not. AFAIK will

Re: 'cpmv' instead of 'cp' Re: [asterisk-users] [tip]semicolon trouble: System($(sleep 4; cp 1.call out)) not working, but System($( sleep 4 cp 1.call out)) ; )

2006-07-08 Thread Tzafrir Cohen
On Sat, Jul 08, 2006 at 09:39:36PM +0200, Robert Michel wrote: Salve Tzafrir! On Sat, 08 Jul 2006, Tzafrir Cohen wrote: To simplify error handling: set -e tmpfile=`mktemp` Note that the temp file has to be in the sme filesystem as the asterisk spool It would be more performant

Re: 'cpmv' instead of 'cp' Re: [asterisk-users] [tip]semicolon trouble: System($(sleep 4; cp 1.call out)) not working, but System($( sleep 4 cp 1.call out)) ; )

2006-07-08 Thread Robert Michel
Salve Tzafrir! On Sat, 08 Jul 2006, Tzafrir Cohen wrote: sslash=$(echo $1 | sed 's/[^/]//g') use 'basename' instead? Good idea, sp=${1%/*} creats trouble when there is no slash inside $1 You should exit with an error if you did not deliver a call file. exit 1 Also, to make this a