Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

HOWTO copy only newer files and preserve structure of directories

Often we need to copy only recently modified files and keep directories in its original states.
To display just modified files we can use command
# find . -type f -mtime 0
where . (dot) means start search from current directory
-type f means find and display only files otherwise directories appear also in the list
-mtime 0 means modify time was within last 24 hours
It looks good so far? Let’s continue.
# find . -type f -mtime 0 | xargs tar -cf /path_to/archive.tar
found filenames will be piped to tar command. Hence archive.tar contains all freshly changed files.
if any filename contains whitespaces it can be correctly handled with small changes
# find . -type f -mtime 0 –print0 | xargs -0 tar -cf /path_to/archive.tar
And what if we need only updated files in the last 10 minutes? It is not a problem at all.
Replace  -mtime 0 with –mmin -10
# find . -type f -mmin -10 –print0 | xargs -0 tar -cf /path_to/archive.tar

Enjoy!



HOWTO wipe space on Hetzner Root Server

If your worry about data left on dedicated/hosted root server and want to remove secure all files and bits,
you can clean complete disk slice or even better to overwrite with random bytes.

DATA CAN'T BE RECOVERED ANY MORE! YOU WILL PROCEED AT YOUR OWN RISK!

1. Start Rescue system from Robot.
The Rescue System can be activated from Robot. After choosing the desired server from the server overview (Menu "Server" -> click on the desired server) go to the tab "Rescue". Here you can activate the Rescue System. After activating the Rescue System an automatically generated password is displayed. Please make a careful note of it as this is the root password of the Rescue System.

2. Login into Rescue System using ssh
3a. If you use default server with RAID 1 (example for an EX server) execute
# dd if=/dev/urandom of=/dev/md2 bs=1M


3b. Or if you use a hardware RAID controller has been installed or the server only has one drive (VQ servers) execute
#  dd if=/dev/urandom of=/dev/sda3 bs=1M

Care of your personal data!


HOWTO change resolution in linux installer

when I installed fedora core it had wrong autodefined screen resolution and screen was truncated so i can't see buttons and I would like to install in graphic mode :)

I have read manual (RTFM !) and found that I can press Tab on first screen and set resolution as

resolution=1024x768




and buttons are back


Enjoy!

Asterisk AST_SORCERY function

 AST_SORCERY gets a field from a sorcery object. Sorcery is always created for PJSIP aors, endpoints and identifies in asterisk. It allows y...