Run Python Script -

Hi all, i'm brand new on FreeBSD, i want to run a python script for pfsense firewall running on FreeBSD (FreeBSD 10.3-RELEASE-p9)

this is the script
https://github.com/edgauthier/pfsense-backup

I already installed beautifulsoup4 (py27-beautifulsoup-4.4.1)

So, when i make this as root
. pfsense-backup.py
get this:
/usr/local/bin/.: Permission denied.


What i tried:
  1. Chmod +x pfsense-backup.py
  2. Chmod 775 pfsense-backup.py
    those are the permissions:
    -rwxrwxrwx 1 root wheel 6278 Mar 21 16:00 pfsense-backup.py
  3. Changes on the script:
    #!/usr/bin/env python2
    to
    #!/usr/local/bin python2

What i doing wrong?

Thanks!
Monchito[/code]
 
So, when i make this as root
. pfsense-backup.py
get this:
/usr/local/bin/.: Permission denied.
If the script is already in /usr/local/bin just use pfsense-backup.py

Why do you think you need the dot?

EDIT: Hold on. This is wrong too:
  1. Changes on the script:
    #!/usr/bin/env python2
    to
    #!/usr/local/bin python2
You could have left the line as is. If you change it, it should be #!/usr/local/bin/python2
 
Hi tobik, i don't know i thought i should.

Now, i get this:

pfsense-backup.py
pfsense-backup.py: Command not found.


Thanks for the help.
 
Hi, back again to Permission denied.

/usr/local/bin: ./pfsense-backup.py
./pfsense-backup.py: Permission denied.



/usr/local/bin: ls -ld
drwxr-xr-x 2 root wheel 6144 Mar 21 18:21


thanks
 
Hi, yes. Reading this : https://docs.python.org/2/using/unix.html y change the Shebang:

old line
#!/usr/bin/env python2

changed for this:
#!/usr/local/bin python2

Either of #!/usr/bin/env python2 or #!/usr/local/bin[color=red]/[/color]python2 (note the /, not ' ') should work, although the first version only works if python2 is found in $PATH.

The first works because it is the env(1) tool that is actually being executed, with an argument of 'python2' as the utility to execute.
 
Either of #!/usr/bin/env python2 or #!/usr/local/bin[COLOR=red]/[/COLOR]python2 (note the /, not ' ') should work, although the first version only works if python2 is found in $PATH.

The first works because it is the env(1) tool that is actually being executed, with an argument of 'python2' as the utility to execute.

Ok, thanks, is good to know. Not work neither #!/usr/bin/env python2 or #!/usr/local/bin/python2


Thanks, i'll ask in pfsense forum.
 
Back
Top