nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Crontab

This is a discussion on Crontab within the Linux software forums, part of the Linux Getting Started category; Hi everyone, On Windows platform, I can run schedule task for shut down my windows machine. How about on linux? ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Linux software

Register FAQ Members List Calendar Forgotten your password? Mark Forums Read
  #1 (permalink)  
Old 05-31-2007, 04:58 AM
Member
User
 
Join Date: May 2007
Posts: 56
Rep Power: 2
lacloai is on a distinguished road
Default Crontab

Hi everyone,

On Windows platform, I can run schedule task for shut down my windows machine. How about on linux? I am trying to schedule a task to shutdown SuSe10 everyday at 1:00AM in the morning. How can I do that? Here is what I did, but it never works.

I run the command "crontab -e" and then I enter this: 0 01 * * * shutdown -h now

Does anyone know how to do it? Please let me know. I really apprecaite that.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-31-2007, 11:47 AM
nixcraft's Avatar
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Ubuntu
Posts: 1,036
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

Quote:
Originally Posted by lacloai View Post
Hi everyone,

On Windows platform, I can run schedule task for shut down my windows machine. How about on linux? I am trying to schedule a task to shutdown SuSe10 everyday at 1:00AM in the morning. How can I do that? Here is what I did, but it never works.

I run the command "crontab -e" and then I enter this: 0 01 * * * shutdown -h now

Does anyone know how to do it? Please let me know. I really apprecaite that.
Your command is correct, only use full path to shutdown command. at a shell prompt type
Code:
which shutdown
Output
Code:
/sbin/shutdown
Write as root user:
Code:
0 1 * * * /sbin/shutdown -h now
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote
  #3 (permalink)  
Old 06-01-2007, 04:44 AM
Member
User
 
Join Date: May 2007
Posts: 56
Rep Power: 2
lacloai is on a distinguished road
Default Hi

You're 100% right. Thank you so much. It's working like a dream. By the way, when I do the schedule to print out the log file on my system. Say, I want to print out the file in /var/log/messages.

# which lpr
/usr/bin/lpr

In the crontab file, I put:
0 18 * * * /usr/bin/lpr /var/log/messages

It should print out the log file(message at 6PM everyday. However, it doesn't. I don't know why. At the command when I run
# /usr/bin/lpr /var/log/messages
It prints out fine. But I doesn't print in the crontab file. Do you know why? I really appreciate that.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
crontab click007 Getting started tutorials 6 10-19-2007 05:45 PM
start and stop service in crontab. gthian Shell scripting 7 05-31-2007 12:04 PM
about crontab darknet Shell scripting 2 01-04-2007 07:01 PM
/etc/crontab file permissions or ownership can cause problem chiku Linux software 2 12-20-2006 02:57 AM
list every user's crontab script marinm Shell scripting 5 07-20-2005 12:24 AM


All times are GMT +5.5. The time now is 08:59 PM.


Powered by vBulletin® Version 3.7.4 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36