Reply
Thread Tools
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#11
Thank you very much! Work like a charm
I also did something and it worked but with more ugly way and with 2 small scripts
 
Schturman's Avatar
Posts: 5,339 | Thanked: 4,133 times | Joined on Jan 2010 @ Israel
#12
 

The Following User Says Thank You to Schturman For This Useful Post:
Posts: 7 | Thanked: 4 times | Joined on Jan 2013
#13
This is a script I wrote to upload the images take from my N950 to a remote ftp folder. The idea was to schedule a cron task to upload any new pictures I've take every 10 minutes ONLY if I am home using the wireless. The script works great if I call it from the terminal manually. Unfortunately I couldn't setup the cron correctly, I keep on getting a permission error when the cron tries to run the script, it will be great if anyone can tell me how to overcome this permission issues.

Btw, you need to install lftp for this script to work

Cheers

Code:
#/bin/bash
FTPU="username"
FTPP="ftp password"
FTPS="remote ftp server"
FTPF="remote ftp server directory"
LOCALD="/home/user/MyDocs/DCIM"

LOGFILE="/tmp/backup.log"
if ifconfig | grep -q -e 192.168.1.200
then
  echo Started Pictures Backup at: `date` >> $LOGFILE
  /opt/lftp/bin/lftp -u $FTPU,$FTPP -e " set ftp:ssl-allow no;set ssl:verify-certificate no; mirror --only-newer --verbose --continue --reve$
  echo Pictures Update Finished at:  `date` >> $LOGFILE
else
  echo "Not at home, not synching anything: `date`" >> $LOGFILE
fi
 

The Following 2 Users Say Thank You to blackcoder For This Useful Post:
Posts: 230 | Thanked: 302 times | Joined on Oct 2009 @ Helsinki, Suomi (Finland)
#14
Originally Posted by blackcoder View Post
/opt/lftp/bin/lftp -u $FTPU,$FTPP -e " set ftp:ssl-allow no;set ssl:verify-certificate no; mirror --only-newer --verbose --continue --reve$
BTW. It seems like something is missing from your lftp command (cut by nano?).

I don't know if following affects your case (I'm fairly clueless about cron)
Note, userids on your system which do not appear in /etc/shadow will NOT have operational crontabs,
https://help.ubuntu.com/community/Cr...ser_Level_Cron

Let's hope someone else with better knowledge of harmattan's user permissions and cron's workings will chime in.
 
Posts: 7 | Thanked: 4 times | Joined on Jan 2013
#15
Yes, you are right

It's supposed to be :
Code:
/opt/lftp/bin/lftp -u $FTPU,$FTPP -e " set ftp:ssl-allow no;set ssl:verify-certificate no; mirror --only-newer --verbose --continue --reverse $LOCALD $FTPF; exit" $FTPS
 

The Following User Says Thank You to blackcoder For This Useful Post:
Posts: 7 | Thanked: 4 times | Joined on Jan 2013
#16
Originally Posted by ladoga View Post
https://help.ubuntu.com/community/Cr...ser_Level_Cron

Let's hope someone else with better knowledge of harmattan's user permissions and cron's workings will chime in.
I already have cron installed and properly triggering the script, I just keep on getting the permission related issues, it tried incepting the cron package and installing it, changing the script permission, running it with different users, but no luck

from /var/log/syslog:

Code:
Jan  8 14:40:01 (2013) /USR/SBIN/CRON[22640]: (CRON) error (do_command:initgroups(0) failed: Operation not permitted)
Jan  8 14:40:01 (2013) /USR/SBIN/CRON[22639]: (CRON) error (grandchild #22640 failed with exit status 1)

Last edited by blackcoder; 2013-01-08 at 03:59.
 

The Following User Says Thank You to blackcoder For This Useful Post:
Posts: 230 | Thanked: 302 times | Joined on Oct 2009 @ Helsinki, Suomi (Finland)
#17
Heve you tried scheduling your script with Profilematic?
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 09:57.