There will come a time when you need to start some scripts at startup, but you don’t want to to create it as a service. This is to help you to accomplish that. There are 2 methods: Using /etc/rc.local , this seems only working on Ubuntu 18.04 and older , from version 19, it seems not working. It’s like a bat file in windows, you create that file if it does not exist: nano /etc/rc.local sh /location to your script/script.sh chmod +x /etc/rc.local Using crontab -e , add this line:  @reboot ( sleep 30 ; sh /location to your script/script.sh )Read More →

session_set_save_handler(“open”, “close”, “read”, “write”, “destroy”, “gc”); function read($id) { //if we can’t find the data for this session, we must return ” (empty string) , can’t return false return ”; }Read More →

This is mostly because the script is hang at some point , the server still keeps the connection, this will end up where server can’t accept new connection. This is a dirty approach – it will kill all process having waiting time > 30s #/bin/bash #Delete all apache having process with waiting time >30s GetAllWorkers() { AllWorkers=$(apache2ctl fullstatus | grep ” W ” | awk ‘$6>30 {print $2}’) for PID in $AllWorkers; do echo stopping $PID with SIGTERM kill -9 $PID done } GetAllWorkersRead More →

mcrypt extension is an interface to the mcrypt cryptography library. mcrypt is included in php5 to  php7.1 , but it’s removed from php7.2 . The instructions below help you install mcrypt for php7.2 on  Ubuntu. sudo apt-get -y install gcc make autoconf libc-dev pkg-config sudo apt-get -y install libgeoip-dev pecl install –nodeps mcrypt-snapshot when you are shown the prompt: libmcrypt prefix? [autodetect] : hit Enter once installed , you need to create a configuration file for it sudo bash -c “echo extension=mcrypt.so > /etc/php/7.2/conf.d/mcrypt.ini”Read More →

When i try to remove a disk in Virtualbox with this command: # VBoxManage storageattach “myvm” –storagectl SATA –port 0 –device 0 –type hdd –medium none I got the following error VBoxManage: error: The machine is not mutable or running (state is Saved) VBoxManage: error: Details: code VBOX_E_INVALID_VM_STATE (0x80bb0002), component SessionMachine, interface IMachine, callee nsISupports VBoxManage: error: Context: “DetachDevice(Bstr(pszCtl).raw(), port, device)” at line 403 of file VBoxManageStorageController.cpp And the fix is: VBoxManage discardstate uuid VBoxManage discardstate 23036a87-de86-4bee-ad92-5eed022a13d9Read More →

rrdcached is a daemon that receives updates to existing RRD files, accumulates them and, if enough have been received or a defined time has passed, writes the updates to the RRD file. A flush command may be used to force writing of values to disk, so that graphing facilities and similar can work with up-to-date data. rrdcached uses the line protocol to communicate with client. When we start rrdcached , it will listen on port 42217 and create a socket file.  We can telnet to port 42217  or use ncat to create a connection to socket file. telnet localhost 42217     or nc -U /var/run/rrdcached/rrdcached.sock AfterRead More →