Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # check if lock_file directory exists if it doesn't create it
- ./create_directory.sh
- # create name for lock file
- #
- lockDir="/root/lock_files"
- # this is the actual lock file
- lockFilePath="$lockDir/file.lock"
- #
- #
- #
- # Loop through servers until file is no longer exists
- #
- while [ -e "$lockFilePath" ]
- do
- exit
- done
- #----begin sample template for future jobs
- # create a new lock file for next job
- # touch $lockFilePath
- # ./new_job
- # echo "copying new job file"
- # dont forget to remove the lock
- # sleep 5
- # rm -f $lockFilePath
- #----end sample template for future jobs
- #
- # create new lock file for a new job
- #
- touch $lockFilePath
- #
- # loop through servers and sync docroots and code
- #
- #-----.conf and .conf.orig files
- # do the first rsync job
- ./copy_samba_etc_folder_files.sh
- echo "copying all .conf and conf.orig files"
- # sleep in X seconds
- sleep 5
- # Remove lock file........
- #
- rm -f $lockFilePath
- #-----sysconfig files
- # create a new lock file for next job
- touch $lockFilePath
- ./copy_samba_etc_sysconfig_folder_files.sh
- echo "copying all sysconfig files"
- #dont forget to remove the lock
- sleep 5
- rm -f $lockFilePath
- #------samba4 file to start samba4 on reboot
- # create a new lock file for next job
- touch $lockFilePath
- ./copy_samba_etc_rc.d_init.d_samba4_file.sh
- echo "copying samba4 file"
- #dont forget to remove the lock
- sleep 5
- rm -f $lockFilePath
- #------ifcfg-eth0 file
- # create a new lock file for next job
- touch $lockFilePath
- ./copy_ifcfg_eth0_file.sh
- echo "copying ifcfg-eth0 file"
- #dont forget to remove the lock
- sleep 5
- rm -f $lockFilePath
- #-----path.sh file
- # create a new lock file for next job
- touch $lockFilePath
- ./copy_profile.d.sh
- echo "copying path.sh file"
- # dont forget to remove the lock
- sleep 5
- rm -f $lockFilePath
- #-----smb.conf file
- # create a new lock file for next job
- touch $lockFilePath
- ./copy_usr_local_samba_etc_samba_conf.sh
- echo "copying smb.conf file"
- # dont forget to remove the lock
- sleep 5
- rm -f $lockFilePath
- #----
- echo "Done"
- ====================================
- create_directory.sh
- ====================================
- #!/bin/bash
- DIRECTORY="/root/lock_files"
- if [ -d "$DIRECTORY" ]; then
- # Control will enter here if $DIRECTORY exists.
- #echo "directory exists do something"
- fi
- #Or to check if a directory doesn't exist:
- if [ ! -d "$DIRECTORY" ]; then
- # Control will enter here if $DIRECTORY doesn't exist.
- #echo "directory does not exist do something"
- mkdir /root/lock_files
- fi
Advertisement
Add Comment
Please, Sign In to add comment