Executing command or script



  • [2.3.2-RELEASE][root@pfSense.localdomain]/root: ls -la s*

    -rwxrwxrwx  1 root  wheel  82448 Sep 29  2009 sendEmail.pl

    [2.3.2-RELEASE][root@pfSense.localdomain]/root: ./sendEmail.pl

    ./sendEmail.pl: Command not found.

    ============================================

    [2.3.2-RELEASE][root@pfSense.localdomain]/root: mv sendEmail.pl /usr/local/bin/sendEmail

    [2.3.2-RELEASE][root@pfSense.localdomain]/root: sudo sendEmail

    sudo: unable to execute /usr/local/bin/sendEmail: No such file or directory

    ============================================

    WTF?

    Regards
    fr0t


  • Rebel Alliance Developer Netgate

    First, a word of caution: Don't copy and run scripts on your firewall from untrusted sources. Or just don't do it at all. It's a firewall, anything added in that way is a security concern.

    Now that the disclaimer is out of the way:
    The error you see means whatever interpreter it has in the shabang line (#!) at the top of the script does not exist. In that case, it's probably pointing to the wrong path for perl (usually this happens when someone copies a Linux-specific script to FreeBSD…). Edit the file and fix the path to point to the correct interpreter.

    That or the file has non-UNIX line terminators



  • Thanks for explaining,

    First: I wouldn't use 3 party scripts if pfSense would have the facility what I am looking for. Basically I am emailing config every hour using crone just for backup purpose in case HDD fail or something else.

    Second: Thanks for solution, correcting path to perl fixed the problem. I was in rush last night and my head was not functioning as supposed.

    Regards
    fr0t


  • Rebel Alliance Developer Netgate

    Sending your config via e-mail is highly insecure and a questionable practice. There are much better ways to accomplish regular backups:

    https://doc.pfsense.org/index.php/AutoConfigBackup

    or

    https://doc.pfsense.org/index.php/Remote_Config_Backup

    But that's a topic for new different thread.