angelmoon
asked on
Perl script gives error in cron
Hello,
I have a perl script which gives me the following error when it runs in cron:
write: can't find your tty
The purpose of the script is to send a notification to sysadm via the write unix command.
The script is as follows:
#!/usr/local/bin/perl
$username = "sysadm";
$message = "here";
open term, "|/usr/bin/write $username";
print term $message;
close term;
exit;
Any ideas on a fix?
Thanks,
Angelmoon
I have a perl script which gives me the following error when it runs in cron:
write: can't find your tty
The purpose of the script is to send a notification to sysadm via the write unix command.
The script is as follows:
#!/usr/local/bin/perl
$username = "sysadm";
$message = "here";
open term, "|/usr/bin/write $username";
print term $message;
close term;
exit;
Any ideas on a fix?
Thanks,
Angelmoon
ASKER
Thanks, kandura. I figured that out yesterday. I discovered that wall -g command works, so I am using that to broadcast a message.
In that case, I suggest you ask for your question to be removed and your points refunded.
I'm just glad I didn't have to go figure out how to find and open tty's ;^)
I'm just glad I didn't have to go figure out how to find and open tty's ;^)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
#!/bin/sh
MESG="here"
USER="sysadm"
echo $MESG | write $USER