Refactor server roles into one that handles all OS physical or virtual
This commit is contained in:
8
server/files/bin/poweroff-force
Normal file
8
server/files/bin/poweroff-force
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This is an instant reboot, like pressing the power switch
|
||||
# only use if you cannot reboot the computer from the normal command
|
||||
# mReschke 2014-03-24
|
||||
|
||||
echo 1 > /proc/sys/kernel/sysrq
|
||||
echo b > /proc/sysrq-trigger
|
||||
31
server/files/bin/purgefiles.py
Normal file
31
server/files/bin/purgefiles.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""Clean old files"""
|
||||
|
||||
__author__ = "Matthew Reschke <mail@mreschke.com>"
|
||||
__license__ = "MIT"
|
||||
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
|
||||
# Usage
|
||||
# Create another file, example /usr/local/bin/clean-system.py
|
||||
# from purgefiles import purge
|
||||
# purge('/store/logs', 540)
|
||||
|
||||
|
||||
def purge(path, older_than_days, file_filter='*', max_depth=999, include_folders=False):
|
||||
del_cmd = 'rm -rfv'
|
||||
typestr = '-type f'
|
||||
if include_folders: typestr = ''
|
||||
#_cmd('find ' + path + ' -maxdepth ' + str(max_depth) + ' -iname "' + file_filter + '" ' + typestr + ' -mtime +' + str(older_than_days) + ' -exec ' + del_cmd + ' {} \; | tee -a ' + log)
|
||||
_cmd('find ' + path + ' -maxdepth ' + str(max_depth) + ' -iname "' + file_filter + '" ' + typestr + ' -mtime +' + str(older_than_days) + ' -exec ' + del_cmd + ' {} \;')
|
||||
|
||||
def _cmd(run, capture_output=False):
|
||||
# Run the cmd
|
||||
if capture_output:
|
||||
proc = subprocess.Popen(run, universal_newlines=True, executable='bash', shell=True, stdout=subprocess.PIPE).stdout
|
||||
return proc.read().strip()
|
||||
else:
|
||||
run = "bash -c '" + run + "'"
|
||||
os.system(run)
|
||||
1843
server/files/bin/speedtest
Executable file
1843
server/files/bin/speedtest
Executable file
File diff suppressed because it is too large
Load Diff
23
server/files/bin/speedtest-hd
Normal file
23
server/files/bin/speedtest-hd
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Basic HD speed test using DD
|
||||
# mReschke 2017-07-11
|
||||
|
||||
file=./bigfile
|
||||
size=1024
|
||||
|
||||
printf "Cached write speed...\n"
|
||||
dd if=/dev/zero of=$file bs=1M count=$size
|
||||
|
||||
printf "\nUncached write speed...\n"
|
||||
dd if=/dev/zero of=$file bs=1M count=$size conv=fdatasync,notrunc
|
||||
|
||||
printf "\nUncached read speed...\n"
|
||||
echo 3 > /proc/sys/vm/drop_caches
|
||||
dd if=$file of=/dev/null bs=1M count=$size
|
||||
|
||||
printf "\nCached read speed...\n"
|
||||
dd if=$file of=/dev/null bs=1M count=$size
|
||||
|
||||
rm $file
|
||||
printf "\nDone\n"
|
||||
6
server/files/bin/watch-process
Normal file
6
server/files/bin/watch-process
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Watch a process output
|
||||
# mReschke 2018-01-19
|
||||
|
||||
sudo tail -f /proc/$(pgrep $1|head -n1)/fd/1
|
||||
Reference in New Issue
Block a user