Help - Search - Members - Calendar
Full Version: Question Regarding SSH
The Planet Forums > System Administration > General Support Questions
cwboaze
HI All,

my question is this:

Is there a command that will display all my crons
on my server through SSH root.

I know most commands but not this one, lol.

And is there a way to edit them through ssh
or where do I go to edit all crons on the server
I got one running when I removed a file after
a install and now it can't find that file, and I need
to modify that cron.

any help would be appreciated.
Thanks,
uneedawebsite
To edit a particular user's crontab from the root, use the following command:

crontab -u username -e

To view all the crontabs on your system, you can use this as a shell script:

CODE
#!/bin/sh



myemail=$1

if [ -n "$myemail" ]; then

       mycrontmp=/root/cron.tmp.$$

       # get current user list

       for i in `cat /etc/passwd | cut -f1 -d :`; do

               echo "--------------------------------------------------"

               echo "Username: ${i}"

               echo "--------------------------------------------------"

               crontab -u ${i} -l 2>&1

               echo "--------------------------------------------------"

       done > $mycrontmp

       cat $mycrontmp | mail -s "crontab report for `hostname`" ${myemail}

       rm -f $mycrontmp

else

       echo "Please supply a valid email address to get the report."

       exit

fi
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.