Script to schedule the Disableing & Enableing ETH Port?

Home Page Forums Network Management Networking Script to schedule the Disableing & Enableing ETH Port?

This topic contains 4 replies, has 0 voices, and was last updated by  matthew.a.squires 7 years, 5 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #43242

    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.

    #52148

    redfive
    Participant

    Of course , is very simple , u have to create two jobs , System>Startup/Cron>Add Job

    ifconfig ETH01 down

    bottom of page , Jobs Scheduling , Hour 23 , Minute 00 , Day ……..then enable the job and save .
    Same as above but

    ifconfig ETH01 up

    Hour 06 , Minute 00 , Day …….
    cheers
    jonatha

    #52149

    Thanks Redfive. I will configure it tonight.

    #52150

    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?

    #52151

    redfive
    Participant

    change the 1st previous jobs with

    dhclient -r ETH01

    and the 2nd

    dhclient ETH01

    the first , will release the ip address from the interface , the second starts the dhcp discover process . should works…
    bye
    jonatha

    #52152

    JC
    Member

    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

    /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

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.