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
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 ๐
This is as bare a node App as you can make but it comes in handy when you want a . dummy server just to return 200s and or a JSON object at super fast speeds on small systems:
var express = require('express'); var app = express(); app.get('*', function(req, res) { res.sendStatus(200); }); app.listen('3000'); console.log('Magic happens on port 3000'); exports = module.exports = app;Before running the js file runnpm install express
to deploy express..
Thats it !
nJoy ๐
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash
logoff and log on
nvm ls-remote nvm install v7.9.0 npm -v node -v
Caveat : ย Lots of node stuff fails to compile and run on such an oldย version of linux be warned…
Thats it you now have node and npm installed. nJoy ๐
setup service listener on viewer machine :
while : ; do ffplay -i tcp://192.168.xx.xx:1234?listen ; done
send video to it :
ffmpeg -re -i /dev/video1 -vcodec mpeg2video -f alsa -i hw:2,0 -ac 2 -s 1920×1080 -r 25 -strict -2 -f mpegts tcp://192.168.xx.xx:1234
where
192.168.xx.xx is the IP of the viewer where the ffplay is running.
1234 is the port used.
nJoy ๐
docker run -p 800:80 -p 2222:22 -p ย 4443:443 ย -it 68715929d32a ย /bin/bash
If ports do not work check :
sysctl net.ipv4.ip_forward
if ย you get:
net.ipv4.ip_forward = 0
then issue :
sysctl -w net.ipv4.ip_forward=1 net.ipv4.ip_forward = 1if you get the error :
docker: Error response from daemon: driver failed programming external connectivity on endpoint amazing_williams (44e256a6039741b20e4124800702d9794d69fb6be9da71ba25059de4dd527121): COMMAND_FAILED: '/sbin/iptables -w2 -t nat -A DOCKER -p tcp -d 0/0 --dport 4443 -j DNAT --to-destination 172.17.0.2:443 ! -i docker0' failed: iptables: <strong>No chain/target/match by that name..</strong>
systemctl stop firewalld systemctl mask firewalld
Created symlink from /etc/systemd/system/firewalld.service to /dev/null.
yum install iptables-services
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirror.euserv.net * epel: fr.mirror.babylon.network * extras: ftp.fau.de * updates: centos.fastbull.org Resolving Dependencies --> Running transaction check ---> Package iptables-services.x86_64 0:1.4.21-16.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================================================================================================================================= Package Arch Version Repository Size ============================================================================================================================================================================================================================================= Installing: iptables-services x86_64 1.4.21-16.el7 base 50 k Transaction Summary ============================================================================================================================================================================================================================================= Install 1 Package Total download size: 50 k Installed size: 24 k Is this ok [y/d/N]: y Downloading packages: iptables-services-1.4.21-16.el7.x86_64.rpm | 50 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : iptables-services-1.4.21-16.el7.x86_64 1/1 Verifying : iptables-services-1.4.21-16.el7.x86_64 1/1 Installed: iptables-services.x86_64 0:1.4.21-16.el7 Complete!
systemctl enable iptables
Created symlink from /etc/systemd/system/basic.target.wants/iptables.service to /usr/lib/systemd/system/iptables.service.
service iptables save iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
try :
docker run -p 800:80 -p 2222:22 -p 4443:443 -it 68715929d32a /bin/bash
You could add the sysctl line to the system or in the /etc/init.d/
pm2 start app.js --log-date-format 'DD-MM HH:mm:ss.SSS'
nJoy ๐