linux commands

useful commands

sudo su //, dont need to type SUDO each time
 
grep -r stringyouarelookingfor foldername_or_*
killall firefox
ps aux | grep firefox
ifconfig
sudo iptables -L
 
sudo service php5-fpm restart
sudo service lighttpd restart
 
sudo service lighttpd stop
 
sudo ufw enable/disable
 
// see webserver, system logfile //

sudo tail /var/log/lighttpd/error.log -f
sudo tail /var/log/syslog -f

smb:polhn-pc0001/ is quick link to connect to MY windows machine 

OLD – NOW USE UPDRAFTPLUS WP PLUGIN
linux backup of web content from ubuntu to windows shared folder

  • connect win share folder and backup daily
apt-get install cifs-utils

sudo mkdir /media/winshare

change /etc/fstab ADD:
//polhn-pc0001/c$/tools/backups /media/winshare cifs  credentials=/home/wadmin/.smbcredentials,iocharset=utf8,sec=ntlm 0 0

!! must change above file password each time password changes !!

in .smbcredentials (chmod 600 for security)
username=msusername
password=mspassword

sudo mount -a

now drive is mapped to /media/winshare

  • daily backup with cron
cd /etc/cron.daily

create a file "liambak", -n means dont recopy existing backups to save time:

#!/bin/bash
cp -n /var/www/wordpress/wp-content/updraft/* /media/winshare

cp -n /var/www/public/wp-content/updraft/* /media/winshare

cp -n /var/www/gregtest/wp-content/updraft/* /media/winshare



then,

chmod +x liambak

 

** note install plugin UPDRAFT PLUS and setup to make daily backups in order to populate updraft folder

Posted in ict