Reputation: 16072
I know I can output script output to a file using :
/path/to/script.sh >& path/to/output.log
The thing is, I'm making an infinite loop in Java that my shell will run, thus the output file will become extremely large.
Is there anyway using linux commands to break the output by max file size to split the logs or instead i have to change outputin Java instead to console to seperate files by max file size?
Upvotes: 1
Views: 147
Reputation: 68715
There is something called multilog, try this:
/path/to/script.sh |[multilog][2] s2000 ./logdir
will run the script capturing stdout to your output.log and rotating it when it is bigger than 2000 bytes.
Upvotes: 2