public:scripts
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
public:scripts [2016/10/03 14:45] – [ssid] Roland Hansmann | public:scripts [2018/02/06 11:10] (current) – [accounts.sh] Roland Hansmann | ||
---|---|---|---|
Line 46: | Line 46: | ||
<? | <? | ||
$file = fread($handler, | $file = fread($handler, | ||
- | preg_match_all('/ | + | preg_match_all('/ |
$urls = $urls[2]; | $urls = $urls[2]; | ||
$rowclass = 0; | $rowclass = 0; | ||
Line 192: | Line 192: | ||
===== BaSH ===== | ===== BaSH ===== | ||
+ | ==== update_dokuwiki.sh ==== | ||
+ | This script updates dokuwiki from tgz file on your document root. The updating file must be named dokuwiki*.tgz | ||
+ | <file bash update_dokuwiki.sh> | ||
+ | #!/bin/bash | ||
+ | set -e | ||
+ | |||
+ | # Set your install dir | ||
+ | INSTALLDIR=/ | ||
+ | |||
+ | [[ `whoami` != " | ||
+ | [[ `pwd` != " | ||
+ | |||
+ | DOKUFILE=`ls $INSTALLDIR/ | ||
+ | [[ -z $DOKUFILE ]] && { echo "No TAR file found matching dokuwiki*.tgz"; | ||
+ | |||
+ | cd $INSTALLDIR | ||
+ | |||
+ | echo " | ||
+ | rm -rf dokuwiki.old | ||
+ | |||
+ | echo " | ||
+ | mv dokuwiki dokuwiki.old | ||
+ | |||
+ | echo " | ||
+ | tar -xzf $DOKUFILE | ||
+ | |||
+ | echo " | ||
+ | mv `find . -type d -name " | ||
+ | |||
+ | echo " | ||
+ | find dokuwiki -name *.dist -exec rm -rf {} \; | ||
+ | |||
+ | echo "Get local configs and acl.auth.php from previous installation" | ||
+ | find dokuwiki.old/ | ||
+ | cp -p dokuwiki.old/ | ||
+ | |||
+ | echo "Get custom smileys from previous installation" | ||
+ | for i in `awk ' | ||
+ | printf " $i" | ||
+ | cp dokuwiki.old/ | ||
+ | done | ||
+ | echo "" | ||
+ | |||
+ | echo "Rsync data from previous installation" | ||
+ | rsync -a --delete dokuwiki.old/ | ||
+ | |||
+ | echo "Clear update messages" | ||
+ | echo "" | ||
+ | |||
+ | echo "Copy active template from previous installation" | ||
+ | TPL=`grep template dokuwiki.old/ | ||
+ | cp -pr dokuwiki.old/ | ||
+ | |||
+ | echo "Copy custom installed plugins" | ||
+ | for i in `ls dokuwiki.old/ | ||
+ | if [[ ! `ls dokuwiki/ | ||
+ | printf " $i" | ||
+ | cp -pr dokuwiki.old/ | ||
+ | fi | ||
+ | done | ||
+ | echo "" | ||
+ | |||
+ | echo " | ||
+ | chown -R www-data dokuwiki/ | ||
+ | chown www-data dokuwiki/ | ||
+ | |||
+ | / | ||
+ | </ | ||
==== ipcheck.sh ==== | ==== ipcheck.sh ==== | ||
This script is executed every 30 minutes by cron from root. It checks if the public IP has changed and sends an email with the notification to dislist the new IP from Spamhaus Blacklist. | This script is executed every 30 minutes by cron from root. It checks if the public IP has changed and sends an email with the notification to dislist the new IP from Spamhaus Blacklist. | ||
Line 1212: | Line 1280: | ||
# decrypt file and exit immediately if passphrase is wrong | # decrypt file and exit immediately if passphrase is wrong | ||
- | gpg -d $ACCOUNTFILE.gpg > $ACCOUNTFILE || exit 2 | + | $GPGBIN |
- | + | ||
- | # remove old encrypted file | + | |
- | rm -f $ACCOUNTFILE.gpg | + | |
# edit | # edit | ||
- | vi $ACCOUNTFILE | + | $VIBIN |
- | # encrypt new file | + | # encrypt new file and overwrite existing one |
echo " | echo " | ||
- | gpg -e -r $USER $ACCOUNTFILE | + | $GPGBIN --yes -e -r $USER $ACCOUNTFILE |
# remove unencrypted file | # remove unencrypted file | ||
Line 1517: | Line 1582: | ||
ifconfig $MON down | ifconfig $MON down | ||
</ | </ | ||
+ | ==== spacewalk-package-installed ==== | ||
+ | This script shows which servers have installed a specific package | ||
+ | <file bash spacewalk-package-installed> | ||
+ | #!/bin/bash | ||
+ | PACKAGE=$1 | ||
+ | VERSION=$2 | ||
+ | RELEASE=$3 | ||
+ | [[ $@ -ne 3 ]] && { echo " | ||
+ | |||
+ | for id in `/ | ||
+ | | ||
+ | | ||
+ | | ||
+ | |cut -f1 -d, |grep -v ^system_id` | ||
+ | do | ||
+ | / | ||
+ | | ||
+ | |cut -f3 -d, |tail -1 | ||
+ | done | ||
+ | </ | ||
===== C ===== | ===== C ===== | ||
public/scripts.1475505952.txt.gz · Last modified: 2016/10/03 14:45 by Roland Hansmann