www.zeroshell.org Forum Index www.zeroshell.org
Linux Distribution for server and embedded devices
 
 SearchSearch  RegisterRegister  UsergroupsUsergroups 
 ProfileProfile  Log inLog in  Log in to check your private messagesPrivate Message 

Script to schedule the Disableing & Enableing ETH Port?

 
Post new topic   Reply to topic    www.zeroshell.org Forum Index -> Networking
View previous topic :: View next topic  
Author Message
matthew.a.squires



Joined: 03 Jul 2008
Posts: 89

PostPosted: Wed Jan 18, 2012 8:24 pm    Post subject: Script to schedule the Disableing & Enableing ETH Port? Reply with quote

Is it possible to schedule an Ethernet Port to be Disable and Enable at certain times via a Script.

For example: Eth01 is Disabled at 11pm & Eth01 is Enabled at 6am.

I am not a Linux Admin and I have no idea who to write the Script. Any and All assistance is greatly appreciated.
_________________
Thank You;
Matthew Squires
Back to top
View user's profile Send private message Send e-mail
redfive



Joined: 27 Aug 2009
Posts: 71

PostPosted: Wed Jan 18, 2012 9:22 pm    Post subject: Reply with quote

Of course , is very simple , u have to create two jobs , System>Startup/Cron>Add Job
Code:
ifconfig ETH01 down
bottom of page , Jobs Scheduling , Hour 23 , Minute 00 , Day ........then enable the job and save .
Same as above but
Code:
ifconfig ETH01 up
Hour 06 , Minute 00 , Day .......
cheers
jonatha
Back to top
View user's profile Send private message
matthew.a.squires



Joined: 03 Jul 2008
Posts: 89

PostPosted: Wed Jan 18, 2012 9:47 pm    Post subject: Reply with quote

Thanks Redfive. I will configure it tonight.
_________________
Thank You;
Matthew Squires
Back to top
View user's profile Send private message Send e-mail
matthew.a.squires



Joined: 03 Jul 2008
Posts: 89

PostPosted: Thu Jan 19, 2012 3:51 am    Post subject: Reply with quote

Redfive, it worked beautifully, but I ran into one problem. I had to refresh the DHCP on the port to get the IP Address.
I tried waiting but it did not work.

Do you mind assisting me with the command to refreshing the DHCP, so that I can place it below the command to bring Up the ETH port?
And can a timer be included, for instance; 5 seconds after the port is UP.

Or a separate CRON Job that I can run 1 minute after bringing the ETH port UP?
_________________
Thank You;
Matthew Squires
Back to top
View user's profile Send private message Send e-mail
redfive



Joined: 27 Aug 2009
Posts: 71

PostPosted: Thu Jan 19, 2012 9:21 pm    Post subject: Reply with quote

change the 1st previous jobs with
Code:
dhclient -r ETH01
and the 2nd
Code:
dhclient ETH01
the first , will release the ip address from the interface , the second starts the dhcp discover process . should works...
bye
jonatha
Back to top
View user's profile Send private message
JC



Joined: 21 Apr 2008
Posts: 89

PostPosted: Sun Jan 22, 2012 4:57 am    Post subject: Reply with quote

this is so funny, not two weeks ago i implemented the exact same thing, was about to post a 'what am I doing wrong?' when I realized i needed the full command path for it to work
Code:
/sbin/ifconfig ETH00 down


Might I suggest you try a static IP on your interfaces (on the setup - network page) to lessen the need to renew dhcp requests.

JC
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    www.zeroshell.org Forum Index -> Networking All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group