Be VERY CAREFUL with this.
sudo dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
π nJoy
Be VERY CAREFUL with this.
sudo dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
π nJoy
curl -sL https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/lsb-release
echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
sudo apt-get update && sudo apt-get install influxdb
sudo service influxdb start
nJoy π
sudo apt-get remove influxdb
apt-get purge influxdb
nJoy π
Referring to the github README.md https://github.com/pm2-hive/pm2-logrotate
pm2 install pm2-logrotate@2.6.0
pm2 set pm2-logrotate:compress true
pm2 set pm2-logrotate:max_size 10M
pm2 set pm2-logrotate:retain 7
pm2 conf
{
"pm2-logrotate": {
"max_size": "10M",
"retain": "7",
"compress": "true",
"dateFormat": "YYYY-MM-DD_HH-mm-ss",
"workerInterval": "30",
"rotateInterval": "0 0 * * *",
"rotateModule": true
},
"module-db": {
"pm2-logrotate": {
"uid": null,
"gid": null
}
}
}
nJoy π
ulimit -c unlimited
nJoy π
This is a simple script to get all cronjbs for all users on a system
for someone in $(cut -f1 -d: /etc/passwd); do echo $someone; crontab -u $someone -l ; done
nJoy π
Hi,
Ubuntu does not carry chkconfig any more ..
besides the standard
update-rc.d apache2 defaults
or
update-rc.d apache2 remove
There is a cool tool called : sysv-rc-conf.
This tool can be installed using :
sudo apt-get install sysv-rc-conf
On its own the command opens a cool ncurses interface like this :
It can Also be used in scripts as :
sysv-rc-conf atd <on or off> and --levels;
man sysv-rc-conf
Will give you some love..
nJoy π
To find out what triggered this use :
more /var/run/reboot-required.pkgs
nJoy π
for FILE in *.webm; do
echo -e "Processing file '\e[32m$FILE\e[0m'";
ffmpeg -i "${FILE}" -vn -ab 128k -ar 44100 -y "${FILE%.webm}.mp3";
done;
nJoy π
This script requires genuine cp -al capable gnu and rsync commands together with a hardlink capable FS + OS.
#!/bin/bash
[ $# -ne 2 ] && echo "Incorrect usage : $0 <source path> <target path>" && exit 128 ;
SOURCEFOLDER=$1
TARGETFOLDER=$2
SF_LEN=${#SOURCEFOLDER}-1
TF_LEN=${#TARGETFOLDER}-1
#echo "Last character in source folder is ${SOURCEFOLDER:SF_LEN}"
if [ "${SOURCEFOLDER:SF_LEN}" != "/" ] ; then
echo "Adding trailing slash"
SOURCEFOLDER=$SOURCEFOLDER"/"
fi
#echo "Last character in target folder is ${TARGETFOLDER:TF_LEN}"
if [ "${TARGETFOLDER:TF_LEN}" != "/" ] ; then
echo "Adding trailing slash"
TARGETFOLDER=$TARGETFOLDER"/"
fi
echo $SOURCEFOLDER
echo $TARGETFOLDER
LOCKFILE=/tmp/`echo $0 $SOURCEFOLDER $TARGETFOLDER | sed "s/[^[:alnum:]]/_/g"`.lck
echo "Lockfile : $LOCKFILE"
[ ! -d $SOURCEFOLDER ] && echo "Source does not exist !! $SOURCEFOLDER exitting with error" && exit 1;
TIMESTAMP=$(date --utc +%Y%m%d%H%M )
#echo $TIMESTAMP
if [ ! -d $TARGETFOLDER ]; then
mkdir $TARGETFOLDER
rsync -av --delete $SOURCEFOLDER $TARGETFOLDER/$TIMESTAMP/
else
[ -d $TARGETFOLDER/$TIMESTAMP/ ] && echo "Folder already there !! Leaving.. " && exit 0;
LASTBACKUP=$(ls $TARGETFOLDER | sort -rn | head -1)
echo "Link copying $TARGETFOLDER/$LASTBACKUP to $TARGETFOLDER/$TIMESTAMP/"
cp -al $TARGETFOLDER/$LASTBACKUP $TARGETFOLDER/$TIMESTAMP/
rsync -av $SOURCEFOLDER $TARGETFOLDER/$TIMESTAMP/
fi
echo " OK !! Done"