Results 1 to 9 of 9
Hi,
I need a cron job to implement in my CentOS server just to copy a tar archive to windows 2003 server. Could you tell me a script for that? ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 08-20-2012 #1
Cron Job Just to Copy a Tar File to a Windows Server
Hi,
I need a cron job to implement in my CentOS server just to copy a tar archive to windows 2003 server. Could you tell me a script for that? In the web there are sample sripts for FTP copying but I need the cp -r command in the cron job.
Thanks
- 08-20-2012 #2
You need permissions on the remote server, then you can mount the remote filesystem using the smbmount command.
If you don't have smbmount available, then you should install the samba tools package from your package manager.
The process you should go through is:
1. mount the remote file system
2. copy the file (you can now use cp -r ... using the mounted directory as the target)
3. unmount the remote file system.Linux user #126863 - see http://linuxcounter.net/
- 08-20-2012 #3
- 08-20-2012 #4
Additional note:
You might want to consider to use the above mentioned mount via autofs instead of a always available mountpoint.
If you rely on the mountpoint to be always available, then you would need to monitor it.
Because if it breaks for whatever reason and at any time: network hickup, someone disconnects and reconnects a network cable, etc
then your cron will fail as a consequence.
autofs will automatically mount that cifs share only when it is needed and then disconnect after 5min of no action.
This is more resilient, because it remounts at every run of that cron.You must always face the curtain with a bow.
- 08-21-2012 #5
- 08-23-2012 #6
Hi,
I wrote a script and it's functioning but I want to optimize it and verify that from you all. My CentOS server has a tar file for each day backup and there are seven backups for the week with seven tar file names and those overwrite weekly. So I have to add seven cron jobs and the script I wrote as follows
could I know whether my umount command is correct????#!/bin/bash
mount -t cifs //192.168.101.26/Backup /mnt/share -o "user=user1,password=xxxxxx,domain=domain1"
cp -r /home/amitha/Desktop/test /mnt/share
umount -t cifs //192.168.101.26/Backup /mnt/share
Thanks
- 08-23-2012 #7
It's close but not perfect. Take a look at the man page for umount. You can probably use:
Code:umount /mnt/share
Linux user #126863 - see http://linuxcounter.net/
- 08-23-2012 #8
- 08-24-2012 #9
Hi ,
Finally I was able to make it working
my shell script isedited the cron file with##!/bin/bash
mount -t cifs //192.168.101.26/Backup /mnt/share -o "user=user1,password=xxxxxx,domain=domain1"
cp -r /home/amitha/Desktop/test /mnt/share
umount /mnt/share
command, and added the cron jobcrontab -e
But I wanted to install the gnome-schedule-2.2.0 it is not in YUM when I enter22 11 * * 5 /home/amitha/Desktop/mount.shcommand it give the error./configure; make; make installchecking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for PYGTK... no
configure: error: Package requirements (pygtk-2.0 >= 2.6) were not met:
No package 'pygtk-2.0' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables PYGTK_CFLAGS
and PYGTK_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target `install'. Stop.
I have tried this make command for several other packages as well, for those also I got this type of error
Many thanks for your help !!!!!
Amitha
Last edited by amithad; 08-24-2012 at 06:29 AM.



