Author: Șerban

  • Move a running process to a screen session

    Suspend the process CTRL+Z Resume the process in background # bg Disown it # disown %1 If you have multiple jobs running, find the correct job number: # jobs -l Enter screen session # screen Find the PID of the process # pgrep processname Attach it to current screen session # reptyr PID

  • Execute cron on a specific day of the month

    # Run on every second Tuesday of the month 20 4 8-14 * * test $(date +%u) -eq 2 && /usr/bin/bash /home/user/ Explanation: Run at 04:20 on every day-of-month from 8 through 14. 20   = 20th minute 4    = 4am 8-14 = between day 8 and day 14 (second week) *    = every month *   …

  • Destroy data on a filesystem by wiping first and last sectors

    Wipe the first 1GB # dd if=/dev/zero of=/dev/sdX bs=1M count=1024 Wipe the last 1MB Some RAID configuration data might be present at the end of the disk, thus existing the need to delete this data, before reusing the disk # dd bs=1M if=/dev/zero of=/dev/sdX count=1024 seek=$((`blockdev –getsz /dev/sdX` – 1024))

  • Batch printer installation on multiple servers

    Using the following bash script you can install multiple printers, on multiple servers. Each printer has its own description, location, PPD file (driver) and network path. All of these details are stored in a file called “printers.txt”, which is a TAB separated, 4 column list. Contents of printers.txt look like this: PR01  HPLJ4000    Office…

  • Bluetooth pairing with dual boot Windows & Linux

    If you use dual-boot, with Windows & Linux, you probably found very annoying the fact that you have to pair all your Bluetooth devices again and again, because they just do not work with both operating systems. Here is a guide to solve this problem…