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. thank you. |
if you mean /etc/cron.daily/script then open your shell and type commands
su /etc/cron.daily/script...change script to whatever it is called |
sorry i am not mean like that.
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.
Thank you. |
I understand....lets keep your example of ls.....with your real command remember you need to tell cron the full pathway
eg /usr/bin/X or /bin/y or /sbin/z ok? copy and paste the following into a text editor excluding the dash line --------------------------------------------- #!/bin/sh ( date; cd / && /bin/ls -al) \ | /bin/mail -s "list daily run on `uname -n`" root exit 0 -------------------------------------------------------------- 2) with root powers save this file as /etc/cron.daily/list then change permissions to make it root power executable. Its easy with Konqueror KDE file manager but if you have to use command line its chmod 700 /etc/cron.daily/list confirm you have correct with ls -al /etc/cron.daily/list reply must be ......-rwx------ 3) test it before you turn off computer with /etc/cron.daily/list and a second later run new command mail....to check its output....the cronjob will mail you each day the command output. |
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 |
All times are GMT -5. The time now is 06:29 AM. |