Some useful Linux commands

Rename files / folders with spaces: IFS=$’\n’;for f in `find .`; do file=$(echo $f | tr [:blank:] ‘_’); [ -e $f ] && [ ! -e $file ] && mv “$f” $file;done;unset IFS Rsync: rsync -r -a -v rsync://ns2/storage/www-srv /storage/ ^^^ from ns2 to new host – (run on new host) Rsync (local to remote)…

Create and manage Linux volumes (LVM)

Create the physical volume: pvcreate /dev/sdb Create the Volume Group: vgcreate vg_backuppc_storage /dev/sdb Create the logical volume: lvcreate -l +100%FREE vg_backuppc_storage Create a filesystem on the logical volume: mkfs.ext4 /dev/vg_backuppc_storage/lvol0 Resize the physical volume: (need to unmount the LV before doing this) pvresize /dev/sdb Extend the volume: lvextend -l +100%FREE -r /dev/vg_backuppc_storage/lvol0 Mount your new…

Exchange 2013 notes

Configure a forwarding address in Exchange shell: [PS] C:\Windows\system32>Get-Mailbox “User_Name” | fl ForwardingSMTPAddress,DeliverToMailboxandForward ForwardingSmtpAddress : smtp:user@example.com DeliverToMailboxAndForward : True DeliverToMailboxandForward specifies that email is delivered both to the users’ mailbox and the SMTP address. You need to create a contact to use the SMTP address. Oddly enough – when I set this – the ForwardingSmtpAddress…

Define a new service in Nagios

To define a new service in Nagios you need to do the following: 1) Add the necessary commands to /etc/nagios/objects/commands.cfg 2) Define the host and service in /etc/nagios/objects/templates.cfg 3) Define a host definition in /etc/nagios/objects/.cfg Command definition in commands.cfg define command{ command_name check-ssl-cert command_line $USER1$/check_ssl_certificate -H $ARG1$ -p $ARG2$ -c $ARG3$ -w $ARG4$ } The…