Category Archives: script

PHPHOST BLOG

Web Hosting Related Articles You May Need

How to rsync certain files, exclude the rest, all while ignoring .svn directories?

I came across this question on the Stack Exchange site Unix & Linux. The question interested me so I answered it but thought I’d cross post it on my blog as well, given I took a pretty significant amount of time to put together a test case and write-up of how the solution ultimately worked.

Problem

I’m […]

Continue reading

Posted in rsync, script, Syndicated, tutorials | Comments Off on How to rsync certain files, exclude the rest, all while ignoring .svn directories?

[one-liner]: Debugging Bash Scripts

Background

From time to time it’s useful if you can turn up the debugging messages that come from Bash, when working out either interactive or shell script problems. Here are 2 methods that can help in getting down to the details.

Solution

There are essentially 2 methods.

Method #1: -x method

When writing a shell script you’ll sometimes want to […]

Continue reading

Posted in bash, one-liner, script, shell, Syndicated, tips & tricks | Comments Off on [one-liner]: Debugging Bash Scripts

[one-liner]: How do you capture the status of a command ($?) in Bash, when run through a pipe?

Background

While answering questions on the stackexchage website Unix & Linux I saw the following question which was about something I’d encountered, but until today never knew how to accomplish, so I’m posting it here for my own reference in the future.

The question?

How do you get the exit status ( $? ) from the command haconf […]

Continue reading

Posted in bash, one-liner, script, shell, Syndicated, tips & tricks | Comments Off on [one-liner]: How do you capture the status of a command ($?) in Bash, when run through a pipe?

[one-liner]: Overview of Bash I/O Redirection

Background

I recently came across this question on the Stackexchange site Unix & Linux. This question was interesting in the sense that it covered much of the I/O redirection facilities that are available in the Bash Shell, so for posterity sake I’m adding my answer to this question here on my blog.

Solution

a number 1 = standard […]

Continue reading

Posted in bash, one-liner, script, shell, Syndicated, tips & tricks | Comments Off on [one-liner]: Overview of Bash I/O Redirection

[one-liner]: How can I Trigger a Notification When a Command Line Job/Process Ends?

Background

Occasionally I need to notify myself when a long running command has finished. Here are a couple of tricks that I use to give me either a audible or visual notification.

Solution

The trick with this is to construct your command like so:

1
% command; command-after &

Then in the command-after position you can do things like this:

1
2
3
4
5
6
7
8
# ring […]

Continue reading

Posted in monitoring, notification, one-liner, script, Syndicated, tips & tricks | Comments Off on [one-liner]: How can I Trigger a Notification When a Command Line Job/Process Ends?

JavaScript Slideshow Code + CSS3 Transitions

This 2KB JavaScript slideshow code is completely configurable through the robust option set and flexible CSS-based structure. Continue reading

Posted in css3, fading, JavaScript, script, slider, slideshow, Syndicated | Comments Off on JavaScript Slideshow Code + CSS3 Transitions

[one-liner]: Using scp to Copy Files that Contain Spaces

Background

Have you ever needed to copy either a single file or a directory that contains spaces using scp? Here are a couple of techniques for how to do this.

Solution

Here are several ways to accomplish the same thing. Copying a entire directory with spaces and copying a file with spaces using scp.

1
2
3
4
5
6
7
# Ways to copy entire […] Continue reading

Posted in bash, one-liner, script, Syndicated, sysadmin, tip, tips & tricks | Comments Off on [one-liner]: Using scp to Copy Files that Contain Spaces

[one-liner]: Download an RTMP Stream & Convert it to an MP3 File via the Fedora/CentOS Command Line

Background

I recently wanted to download a podcast that was being served via a RTMP stream. RTMP (Real Time Messaging Protocol) was initially a proprietary protocol developed by Macromedia for streaming audio, video and data over the Internet, between a Flash player and a server. Macromedia is now owned by Adobe, which has released the specification […] Continue reading

Posted in audio, centos, fedora, mp3, one-liner, script, streaming, Syndicated, tips & tricks | Comments Off on [one-liner]: Download an RTMP Stream & Convert it to an MP3 File via the Fedora/CentOS Command Line

[one-liner]: Changing a ISO File’s Volume ID via the Command Line on Linux

Background

Have you ever needed to change the Volume ID on a pre-existing ISO file? I thought for sure there had to be a command-line tool that would allow for this. But after googling for over an hour I could only find 2 methods to do this.

The first was simply firing up a GUI, such […] Continue reading

Posted in DVD, linux, one-liner, perl, script, Syndicated, tips & tricks | Comments Off on [one-liner]: Changing a ISO File’s Volume ID via the Command Line on Linux

[one-liner]: Using the Linux Command, dirsplit, to Dynamically Backup a Directory Over Multiple DVDs

Background

At my day job I deal with a fair amount of image data. We typically are shipping the data out on either hard drives, thumb drives, or via SFTP. On occasion we will some times burn it to a CD and/or a DVD. But until today all the data was either large sets (200-400GB) variety, […] Continue reading

Posted in backup, centos, DVD, fedora, iso, one-liner, redhat, rhel, script, Syndicated, sysadmin, tips & tricks | Comments Off on [one-liner]: Using the Linux Command, dirsplit, to Dynamically Backup a Directory Over Multiple DVDs