I have a script I run to setup port assignment on deluge which is failing only when running from cron. The important part is the last lines running deluge-console commands. The scripts runs without an error when running manually, but using a cron job it fails. Any help would be appreciated. thanks
crontab as user (log file added to collect errors)
Code: Select all
18 * * * * bash /home/alleyoopster/scripts/pia_portforward.sh >> /home/alleyoopster/pia_port.log
Code: Select all
#Get the local ip address
VPN_IP=$(ifconfig $TUN|grep -oE "inet addr: *10\.[0-9]+\.[0-9]+\.[0-9]+"|tr -d "a-z :")
echo "Your VPN ipaddress is " $VPN_IP
echo Contacting PIA for port forwarding .......
TMP_PORT=$(curl -d "user=$USERNAME&pass=$PASSWORD&client_id=$(cat ~/.pia_client_id)&local_ip=$VPN_IP" https://www.privateinternetaccess.com/vpninfo/port_forward_assignment)
PORT=$(echo $TMP_PORT | sed "s/[^0-9]*//g")
echo "Port forwarding is currently using port "$PORT
echo "Changing port settings on deluge...."
deluge-console "config --set random_port False"
deluge-console "config --set listen_ports ($PORT,$PORT)"
Code: Select all
malformed expression (,)
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/deluge/ui/console/main.py", line 344, in do_command
ret = self._commands[cmd].handle(*args, **options.__dict__)
File "/usr/lib/python2.7/dist-packages/deluge/ui/console/commands/config.py", line 104, in handle
return self._set_config(*args, **options)
File "/usr/lib/python2.7/dist-packages/deluge/ui/console/commands/config.py", line 140, in _set_config
val = simple_eval(options["set"][1] + " " .join(args))
File "/usr/lib/python2.7/dist-packages/deluge/ui/console/commands/config.py", line 87, in simple_eval
res = atom(src.next, src.next())
File "/usr/lib/python2.7/dist-packages/deluge/ui/console/commands/config.py", line 56, in atom
out.append(atom(next, token))
File "/usr/lib/python2.7/dist-packages/deluge/ui/console/commands/config.py", line 79, in atom
raise SyntaxError("malformed expression (%s)" % token[1])
SyntaxError: malformed expression (,)