BASH & cron, creating a file and pushing content.

Hello,
I have a a cron task which runs a bash script that daily creates backup for mysql,
i want that script to create a text file and insert it the data which was generated by bash and was supposed to send to my email, the file will be later on read by a php script which checks numerous routine checks, and sums it up into an email.

Please modify the following bash script so it dumps what's supposed to be dumped into a file named backupLog. (That file will be overwritten by bash daily because of this cron script, so if there are permissions needed please add them too)

If I understand you correctly, you want to have your output send by email and additionally, you want to have it saved to backupLog file, right? If so - just add one more line at the end of your script.
If you want to work with this file with php later, replace "/path/to/" with some directory, to which your php/apache has read permissions.

If you want to put some output into the *system* logs, have a look at the man page for logger e.g. "man -s 1 logger" in a command window. Doing it that way will look after timestamping the message so you could do something like shown. This will log messages in category user.notice. Add logger options to your taste - see "man -s 3 syslog" for available facilities (e.g. "user") and level (e.g. "notice").

The Percona Live Open Source Database Conference Europe 2017 is the premier event for the diverse and active European open source database community, as well as businesses that develop and use open source database software.

1. what happens after content has been pushed to this file and then a day later more content is pushed, does that overwrite the file?
2. To evade permission problems do i need to create the file myself and chmod it to 755 ?

If you use logger, output is continually appended. Log files can be rotated by logrotate (a standard utility on most systems). Any user can use logger and log files are owned by root. No need for abnormal permissions. You can configure to use your own file via /etc/syslog.conf

SSH (Secure Shell) - Tips and Tricks
As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…