piping problem

Marc Grober mgrober at ahfc.state.ak.us
Wed Jan 23 13:45:03 GMT 2002


I have a perl script that allows for some CGI messaging.
I decided to add smb messaging as an option so did a
system call to pipe the message so:

/usr/bin/echo $MESSAGE | /usr/local/bin/smbclient  \
-M $RECIPIENT | /usr/bin/at -t $TIME

Unfortunately, what happens is that the smbclient action is executed
immediately (its spawning its own process) and there is a null at job
created. If I use the here now construct substitution for $MESSAGE
doesn't take place until the at job is run, and of course at that time
there is no MESSAGE.......

at -t $TIME <<!
/usr/bin/echo $MESSAGE | /usr/local/bin/smbclient -M $RECIPIENT
!

I need to be able to substitue for all variables such as MESSAGE when
the script is run, but delay running smbclient until scheduled by at.
I don't want to have a lot of open files to track and even using file$$
would be impractical as I would still have to somehow track the pid of
the initial script and then pass that to the at command with a rm....

Any ideas?

I have tried the following:
system ( "echo '/usr/bin/echo '\"$MESSAGE\"\|'/usr/local/bin/smbclient 
-M '$RECIPIENT>/tmp/mess$$;at -t $TIME /tmp/mess$$" );
which works from the command line but not inside the script
(the $MESSAGE is empty or is just not getting written to the tmp file.....





More information about the samba mailing list