This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
###################################################################### | |
# Check how many unique leases are defined in /var/db/dhcpd.leases | |
# If there are more leases than a specified number send an email | |
###################################################################### | |
# Estimate how many IP address leases there are | |
NUM_LEASES=$(grep ^lease /var/db/dhcpd.leases | sort -rn | uniq | wc -l | tr -d ' ') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
###################################################### | |
# Create a new SFTP user and configure their chroot | |
###################################################### | |
if [ $# -ne 2 ]; then | |
echo "Usage: add_sftp_user.sh username password" | |
exit 0 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HG changeset patch | |
# User Paul Boddie <[email protected]> | |
# Date 1318183386 -7200 | |
# Node ID 51e0575a1ee9907dd24da95c2951fce145a36518 | |
# Parent 89882824b375c0afe55433de0e5ccc081a740c82 | |
Added support for home page namespaces other than at the root of a site by | |
employing a homeprefix setting. | |
Changed the serveopenid action, autoadmin security policy, MyPages action and | |
the OpenID identity advertising in the Page class to work with home pages that | |
have a non-empty homeprefix. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MySQL database dumps | |
05 23 * * mon-fri root mysqldump --all-databases --events -pXXXXXXXX | gzip > /var/backup_files/mysqldumps/mysql-dbs-$(date +\%F).sql.gz | |
# Only keep the past 2 weeks of backups | |
00 23 * * * root find /var/backup_files/mysqldumps/ -mtime +14 -delete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOGDIR="/var/logs" | |
LOGFILE="ldap-add-user-"$(date +"%F_%H%M")".txt" | |
LOGPATH=$LOGDIR'/'$LOGFILE | |
if [ $# -ne 7 ]; then | |
echo "Usage: ldap_add_user.sh username firstname lastname password organisationunit maildomain authdnuser" | |
echo "Example: ldap_add_user.sh test.user test user hunter1 ou=Staff,dc=example,dc=com example.com cn=admin,dc=example,dc=com" | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
LOGDIR="/var/logs" | |
LOGFILE="change-ldap-password-"$(date +"%F_%H%M")".txt" | |
LOGPATH=$LOGDIR'/'$LOGFILE | |
if [ $# -ne 3 ]; then | |
echo "Usage: change_ldap_password.sh username oldpassword newpassword" | |
exit 0 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# SMB mounts required for doing SMB rsync's with an rsync-mirror cron job | |
mount.cifs -o user=administrator,password=XXXXXXXX //test01/c$ /mnt/test01mount |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PC_DIR="/var/lib/backuppc/pc" | |
REMOTE_SERVER=$1 | |
SSH_PORT=$2 | |
# SSH to a remote server to run the specified command | |
remote () { | |
ssh -p $SSH_PORT root@$REMOTE_SERVER "$@" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Do a check to ensure BackupPC is running, if not email root | |
00 12 * * * backuppc /usr/share/backuppc/bin/BackupPC_sendEmail -c | |
# Email a daily host summary | |
50 18 * * * root wget --user=backuppc --password=XXXXXXXX -O hostsummary.html http://backupserver/backuppc/index.cgi?action=summary > /dev/null 2>&1; cat hostsummary.html | mail -a "Content-type: text/html" -a "From: [email protected]" -s "Backup Summary" [email protected] > /dev/null 2>&1; rm hostsummary.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
TARGETDISK="/dev/mmcblk0" | |
TARGETPARTITION="p1" | |
MOUNTPOINT="/media/mmcblk0p1" | |
# Unmount the current SD card | |
echo "Unmounting SD card..." | |
umount $MOUNTPOINT | |
echo "" |
OlderNewer