LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-06-2007, 06:33 AM   #1
ddaas
Member
 
Registered: Oct 2004
Location: Romania
Distribution: Ubuntu server, FreeBsd
Posts: 474

Rep: Reputation: 30
can't add a default route from cron


Hi there,
I want to add a default route from cron and it doesn't work. I can't image why. Maybe there are some cron variables or something...??!!

1. crontab -e (as root)
* * * * * route add default gw X.12.12.1


or

* * * * * /root/s1

and s1 contains the command from above.

When I run the script manually it works, but not from cron.

Any help would be appreciated.

Thanks
 
Old 12-06-2007, 07:11 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Use the full path for the route command in crontab, or in the script:
Code:
* * * * * /sbin/route add default gw X.12.12.1
 
Old 12-06-2007, 07:41 AM   #3
ddaas
Member
 
Registered: Oct 2004
Location: Romania
Distribution: Ubuntu server, FreeBsd
Posts: 474

Original Poster
Rep: Reputation: 30
Thanks,
It worked!
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about route add default ppp0??? marsh58 Linux - Networking 3 06-26-2006 08:59 AM
unable to add default route (network unreachable) beebop Linux - Networking 12 05-30-2005 11:07 AM
How to add a route table for eth1 and make it the default banner Linux - General 3 05-08-2005 11:14 AM
route add default gw ... dhsieh Linux - Software 1 10-15-2003 01:40 PM
Permanently set "route add" -host and default gw sacants Linux - Newbie 1 07-18-2003 04:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration