This file contains hidden or 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 | |
| date | |
| cat ips.txt | while read output | |
| do | |
| echo 'ping' $output | |
| ping -c 1 "$output" > /dev/null | |
| if [ $? -eq 0 ]; then | |
| echo "node $output is up" | |
| else | |
| echo "node $output is down" |
This file contains hidden or 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
| """ | |
| Select database based on URL variable | |
| Inspired by this Django snipped: | |
| https://djangosnippets.org/snippets/2037/ | |
| It's assumed that any view in the system with a cfg keyword argument passed to | |
| it from the urlconf may be routed to a separate database. for example: |
This file contains hidden or 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 | |
| mysqlbkdir='/mnt/web/webbackup/mysql/' | |
| sqlfile='www-vuedo-'`date '+%F'`'.sql.gz' | |
| webdir='/var/www/vuedo' | |
| oldsqlfile=$mysqlbkdir'www-vuedo-'`date '+%F' --date='1 days ago'`'.sql.gz' |
This file contains hidden or 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
| function array_orderby() | |
| { | |
| $args = func_get_args(); | |
| $data = array_shift($args); | |
| foreach ($args as $n => $field) { | |
| if (is_string($field)) { | |
| $tmp = array(); | |
| foreach ($data as $key => $row) | |
| $tmp[$key] = $row[$field]; | |
| $args[$n] = $tmp; |
This file contains hidden or 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
| function array_sort($array, $on, $order=SORT_ASC) | |
| { | |
| $new_array = array(); | |
| $sortable_array = array(); | |
| if (count($array) > 0) { | |
| foreach ($array as $k => $v) { | |
| if (is_array($v)) { | |
| foreach ($v as $k2 => $v2) { | |
| if ($k2 == $on) { |