The below script was set to check for a specific file mapping that was disconnecting. If detected it will then remap the drive.
Simply change the s part in s:null to your drive letter and then add in the Email and mapping details which are highlighted in caps with the hyphen (eg EMAIL-HERE)
if exist s:nul if exist map.lock del map.lock & goto END
if exist map.lock goto END
if exist s:nul goto END
print "drive not mapped"
blat -to "EMAIL-HERE" -server SMTP-HERE -f SERVER-HERE@root.com -subject "Mapping Failed" -body "drive Mapping Failed/disconnected"
echo & map.lock
net use s: \\DNS-ADDRESS-HERE\FOLDER-HERE
To run a init.d script as a different user.
Add the below to the script
To cd into a directory to run a specific command as part of a bash script.
Add the below command
cd /usr/local/directory; \ | pwd
I have been looking at options for alerting on Graphite metrics. Currently using seyren (https://github.com/scobal/seyren) which is an alerting dashboard addon for graphite, however there was no init.d script as part of the addon.
I have created one here https://github.com/wingZero21/Seyren-Init hopefully this can be helpful for someone.
To run a bash script in the background as a daemon.
Run the below
nohup ./SCRIPTHERE &
You may need to press enter afterwards, just check its running by doing a
ps -ef | grep SCRIPTHERE
Below is a script which should allow you to copy multiple files that exist on different servers to one location.
You will need SSH keys setting up if you dont want to enter in the password for each time the request is sent to the server.
Further info here
# FILE: copyfiles.sh
# USAGE: ./copyfiles.sh
# DESCRIPTION: Copies files on multiple servers to one server from text list of servers hostnames
# OPTIONS: The right to remain silent
# NOTES: Above^
# CREATED: 18/01/12 13:43:03 BST
for IP in $servers
scp usernamehere@$IP:/var/log/monitor/file.txt destinationserver.net:/tmp/
Problem is in the title.
Had an issue running a bash script on a wacky csh server.
Then just add the below to the script, you never know this might save your life :D!