Re: bash script not working properly
Mike Miller <[email protected]>
| Newsgroups | gmane.user-groups.linux.tclug |
|---|---|
| Message-ID | <alpine.DEB.2.21.1910301925510.6882@taxahome2> |
Could the problem be with the way you need to make files in rapid
succession, changing their names and sometimes not getting that done fast
enough? Could you switch the order around a bit like this?:
DATE=$(date +%F-%H:%M:%S)
touch /home/raymond/${DATE}.pcapng
tshark -i enp1s0 -a duration:60 -w /home/raymond/${DATE}.pcapng
echo "All Done!"
I dropped the 1 from the filename and added seconds so that doing more
than one per minute isn't a problem. It's just one script instead of two.
If another starts before an earlier one finishes, you probably won't have
a problem.
Mike
On Wed, 23 Oct 2019, [email protected] wrote:
> I have a simple bash script (ws.sh), with the following 2 commands:
>
> #!/bin/bash
>
> tshark -i enp1s0 -a duration:60 -w /home/raymond/capture.pcapng
>
> wait
>
> /home/raymond/movit.sh
>
> Movit.sh:
>
>
> #!/bin/bash
> mv capture.pcapng $(date +%F-%H:%M)1.pcapng && touch capture.pcapng
> echo "All Done!"
>
> The first command always works properly but the second does not run via cron. However, running the script (ws,sh) via the command line executes properly. I have tried sleep and wait between commands but nothing works, so far.
>
> Ideas?
>
>
>
> Raymond Norton
> LCTN
> 952.955.7766
>
_______________________________________________
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
[email protected]
http://mailman.mn-linux.org/mailman/listinfo/tclug-list