Jump to content

Backup routine having issues with exec


Newander5

Recommended Posts

Hi all, sorry if this quesiton seems stupid or confusing.

I am trying to update a backup routine that was created by my predecessor. In a nutshell we've added a new directory to the backup list.

Very simple script, basically centered around:

[code]exec ("tar czvf /os/vm/temp/$fname.tar.gz /os/vm/msg/* /os/vm/dat/*");[/code]

Very very simple, we just tarball a couple directories, they are generally around 2-3 MB total. Works perfectly fine.

However, as I said I need to add a third directory, so I changed it to this:

[code]exec ("tar czvf /os/vm/temp/$fname.tar.gz /os/vm/msg/* /os/vm/tab/* /os/vm/dat/*");[/code]

The problem is that now all I get in my tarball is the "dat" and "tab" directories, "msg" just gets left out altogether. If I run it from the command line it's fine. I am guessing maybe it's a timeout issue or memory issue, though the "tab" directory is only like 400k in size.

In the php.ini safe_mode = OFF, max_execution_time = 30 seconds, and memory_limit = 16M (it's an embedded system and only has 16M RAM to work with)

I can't think of anything else that would cause this, thus my posting here. I am not sure what other information to provide as there's really not a lot to the action. I am not sure if this is a PHP issue or an O/S issue.

Any help is greatly appreciated!
-Shawn
Link to comment
https://forums.phpfreaks.com/topic/23893-backup-routine-having-issues-with-exec/
Share on other sites

Yeah, I should have mentioned that, huh?

The return value is 0, and the output listing gives a list of all files compressed, which is simply absent of the "msg" directory. So not a terrible amount of help from the return value...

[EDIT] Also, if I remove the "dat" directory, I am left with a tarball containing only "tab", no "msg" still. Increasingly believing it must be a RAM thing, but the "tab" directory that is getting lobbed off is tiny...
[list]
[*]Is safe mode on? [b]Update:[/b] You mentioned it's off--oops.
[*]Are there files in msg? (I have to ask...)
[*]Could this be a permission issue? Although, I would think your return would be non-0 if it was...
[*]How many total files are in these directories? This could be an issue where you need xargs.
[*]Have you tried tee-ing the process to see what's going on?
[/list]
Yes, all 3 directories have files, and don't worry, I would ask me the same thing ;)

Permissions are identical across all 3, and I'd also expect an error code of some sort if it's a permissions thing.

"msg" has 29, "tab" has 9, and "dat" has 5. ("tab" is the newly added directory) Given that I only added 9 files I didn't think it'd trigger a need for xargs, but I will try it.

Not quite sure how I'd tee this particular process, so no, haven't done it.

Works fine, packages it all with no issues. Same if I do tab by itself or dat by itself. Or if I do msg and dat. Or if I do tab and dat.

But if I do msg and tab all I get is msg, and if I do msg, tab, and dat all I get is msg and dat.

tab and msg just do not seem to want to live together.

And I just tested it with xargs: same results

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.