using crontab how to show on tty1 or from GUI "xterm".
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
using crontab how to show on tty1 or from GUI "xterm".
hi, I am in RHEL5, i know how to setup cron job, but i dont know how to run the one of the cron job on tty1 or on GUI x-term. Example: i want the cron job to list all files on root, ok i first create a file name "cron_ls", than i edit it by vi editor as below:
****1 ls -al
than i save this file "cron_ls" at root.ok now i want to add this job to crontab. command:
# crontab cron_ls
ok. i have success run this cron job, but if i want this cron job run on my screen "tty1" or on my GUI Gnome terminal, like normal went i operate my RHEL5, example: i want to run command to list all my root file, than i just direct go to tty1 than issue the command ls -al than will show the result on my screen "tty1", or i using GUI,than open gnome terminal than do the same thing will also display the result on mu gnome terminal. Now i want the cron job also same show on my "tty1" screen,or on my GUI gnome terminal.
sorry i am not mean like that, what i am said is, i want my cron job went it running will totally same like what i am sit infront my system and issue the command the running and the display & output. example: i am infront my system i open tty1 or open GUI gnome terminal to issue command ls -al than my monitor screen will come out the result, what i want is my cron job also totally like that.
You can send output to another terminal by redirecting to the correct /dev/ttyN or /dev/pts/N, where N is the identifier of the terminal or pseudo-terminal in which you want to print output. Suppose you have /dev/pts/1 open: you can do something like
Code:
39 0 * * * /bin/ls -al > /dev/pts/1
The problem is to determine which terminal is open/available. For example, you can write a little script which parses the output of the who command and extract the relevant piece of information. Once the script has found all the available terminals, it will try to send output to all of them in sequence until the ls command exit successfully.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.