Run custom shell script (not at boot time)

  • Hi guys.

    I was trying to search the answer but only found how to run script at the boot.

    Here is my question.

    I want some maintenance run at night (2am), when not much is going on on my LAN.

    I wrote the script, made it executable, add new cron job using crontab -e…

    But nothing went through. I tried to run script manually from CLI, and it didn't go.

    How can I do this?


  • Not really much info provided to go on so I’ll attempt being clairvoyant.

    Try this

    login as root
    cd to script directory
    chmod 777 script_file

    If that does not work then something is probably wrong with the script.  Make a simple script to echo something out to the console and see if that will run.

  • nope…. :(

    doesn't work. See attached screen shot.


    works. It was my mistake. I put !/bin/bash instead of /bin/sh...

    Thanks for reply.

    All the best.

    ![Screen Shot 2014-02-24 at 3.24.47 PM.png](/public/imported_attachments/1/Screen Shot 2014-02-24 at 3.24.47 PM.png)
    ![Screen Shot 2014-02-24 at 3.24.47 PM.png_thumb](/public/imported_attachments/1/Screen Shot 2014-02-24 at 3.24.47 PM.png_thumb)

  • Your edits to crontab will get lost when you reboot - pfSense rebuilds all that from its config at boot time. Install the cron package and use that to add your cron job. It will survive reboot.

  • Thanks!

    I did as you advised.

    All the best.

Log in to reply