I've written a short script to copy Apache's server status to a log:#Save date and time to a variabledt=$(date)#Echo date and time to the log file as it's not included in server-statusecho Time : $dt >> /var/logs/server-status.log#Grab machine readable server-status and add it to the logcurl localhost/server-status?auto >> /var/logs/server-status.logI'm running it every five minutes from a cron job in /var/spool/cron/root but taking a look at the sysstat logs it seems to be using progressively more memory:So my question is: Could I be causing a memory leak by continually writing to this variable?Do I need to kill it after the script is run?
Can continually assigning a variable in a shell script cause a memory leak?
shell script;cron;memory
The answer is: Yes, it can.  Provided there is a bug in the script interpreter.But, in your code you are not doing anything funny so if you are using stable version of the shell, it's almost 100% sure your problem is somewhere else.