0

I am trying to make a crontab on my laptop to make a backup of my scripts folder every day at 21.00 pm.

This is what I did :

my crontab line :

00 21 * * * /bin/tar -cvpzf /run/user/1000/gvfs/smb-share\:server\=192.168.1.56\,share\=share/LUCA/backups/scripts.tgz /home/luca/Scripts/

The directory link is ok, because the command :

cd /run/user/1000/gvfs/smb-share:server=192.168.1.56,share=share/LUCA/backups

work well.

The folder stays on my ubuntu server, I am sharing it using samba. Maybe it is a permission problem? I am a bit confused..

When I watch permissions on server the output is : drwxr-xrwx 6 root root 4096 Sep 27 22:21 LUCA

BUT when I launch the same command on the client side (my laptop) I get this :

drwx------ 1 luca luca 0 Sep 27 22:21 LUCA

Any idea? thank you in advance

1 Answer 1

0

I strongly recommend to use a small script to make your backup instead. /run location is not mostly used by the system and cannot be considered as a real path location. Here a sample of the backup script:

#!/bin/bash
TMP=$(mktemp -d)
mount -t cifs //192.168.1.56/share/LUCA/backups/ "$TMP" -o username=samba_login,password=samba_password
tar cpzvf "$TMP"/scripts.tgz /home/luca/Scripts/
umount "$TMP"
rmdir $TMP

Paste this content in a file by example /usr/local/bin/my_backup and add execution permission with chmod +x /usr/local/bin/my_backup.

Finally create a crontab file by exemple in /etc/cron.d/my_backup and paste the following content.

00 21 * * *   root    /usr/local/bin/my_backup

You might need to install extra tools named cifs with sudo apt install cifs-utils.

1
  • edit: I missed the credential, of course replace samba_login and samba_password with your real user.
    – ob2
    Sep 27, 2017 at 21:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .