954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Help with shell script to auto gzip a .sql dump after backup

Hi there,

I have a script in my intranet to which I have 100% rights to run through browser using exec(); passthru(); system(); etc with php.

Now we use this to make automated backups per user database of certain systems connected. Very simple for the end-user after done working and very complex for the managers to process. So I rather not explain.

It comes down to a control panel page where certain things can be performed, including running this script for a personal copy, system backup and extra backup for company archive.

The dumps are quite big in some situations and the system resources can handle the stress and load easy to also gzip the results.

But how do I gzip the result properly using a .php script that runs a .sh or perl file?

Please help me :)

I tried piping the command and stuff, but I resulted in 0byte files.
Hopefully someone has an example for me.

floris
Junior Poster
162 posts since Jan 2004
Reputation Points: 115
Solved Threads: 2
 

You should check out DreamInCode.net for more help! I hope this reply came fast enough!

arithehun
Light Poster
37 posts since Sep 2009
Reputation Points: 9
Solved Threads: 3
 

You can add the code to the shell script. I'm guessing you're doing a MySQL dump of the data into a .sql file? Just add another line to the shell script to tar -czf {file.sql}. Either that or provide more details on what the shell script is doing in the first place.

TheOgre
Posting Whiz
393 posts since Aug 2003
Reputation Points: 128
Solved Threads: 9
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You