ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am creating a bash script that will automatically open and close a perl script with the AT command. This is on RHEL 6 cli only. The problem I am having is that the perl script can't open automatically, but can open manually. I had a log created whenever there is an attempt that AT executes a process in the queue. This is what I got "TERM not set at /root/testscript.pl line 154"
TERM is set to undef, but I asked a colleague of mine and he says that the main issue is that the perl script needs to run on its own terminal. This is what the bash script looks like.
Code:
echo "setsid sh -c 'bash -c /root/testscript.pl <> /dev/tty4 >&0 2>&1'" | at 14:00
echo "pkill -INT testscript" | at 15:10
echo "setsid sh -c 'bash -c /root/testscript.pl <> /dev/tty4 >&0 2>&1'" | at 15:20
echo "pkill -INT testscript" | at 16:30
echo "setsid sh -c 'bash -c /root/testscript.pl <> /dev/tty4 >&0 2>&1'" | at 16:40
echo "pkill -INT testscript" | at 17:50
I also tried
Code:
echo "bash -c /root/testscript.pl > /dev/tty4" | at 14:00
echo "pkill -INT testscript" | at 15:10
echo "bash -c /root/testscript.pl > /dev/tty4" | at 15:20
echo "pkill -INT testscript" | at 16:30
echo "bash -c /root/testscript.pl > /dev/tty4" | at 16:40
echo "pkill -INT testscript" | at 17:50
I even replaced bash -c with /usr/bin/perl. Still no luck. Any suggestions?
Last edited by mastersenpai; 06-26-2015 at 04:40 PM.
The problem I am having is that the perl script can't open automatically, but can open manually.
Please explain what the PERL script actually does, if you have tried debugging it, if you have actually set the TERM variable (as it actually asks for it) and if you really need to test things as root user? (And I doubt running it via cron would change anything.)
Please explain what the PERL script actually does, if you have tried debugging it, if you have actually set the TERM variable (as it actually asks for it) and if you really need to test things as root user? (And I doubt running it via cron would change anything.)
It performs automated test calls to a FreeSWITCH server. I am doing everything in root. I tried googling what TERM variable I could change it to and even went to perldoc and couldn't find it.
run complete scripts with at (not AT, by the way, that is something to do with modems):
Code:
$ cat dosomething.sh
#!/bin/sh
exec >>/tmp/debug.$$ 2>&1
set -xv
date
(actual commands)
$ echo './dosomething.sh' | at 14:00
On the other hand, if the problem exists in the 154th line of the perl-script, it cannot be solved via at
So then I take it that I can't be able to use the at command in the bash script and can only do that as an actual command? I'm still a little confused.
Last edited by mastersenpai; 06-29-2015 at 09:56 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.