Jump to content

Mr.xs

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by Mr.xs

  1. I've added two command to my script and it is working, so thanks for help. #!/bin/bash cd /var/log/ echo "Stoping log service..." /etc/rc.d/rc.rsyslogd stop grep -h -v "input irq status" syslog.5 syslog.4 syslog.3 syslog.2 syslog.1 syslog >> tempfile diff <(tail -n 15 syslog) <(tail -n 15 tempfile) 1>/dev/null if [[ $? == "0" ]] then echo "The same" rm syslog.* else echo "Not the same" fi diff <(tail -n 15 syslog) <(tail -n 15 tempfile) if [[ $? == "0" ]] then echo "The same" mv tempfile syslog else echo "Not the same" fi /etc/rc.d/rc.rsyslogd start echo "Done"
  2. I've found a solution for my problem and now everything is working fine. So this is working script which I wrote to solve this issue with UPS, feel free to try it out. #!/bin/bash cd /var/log/ status=$(grep -h -c "input irq status" syslog) if [ $status -ge 1 ]; then echo "Stoping log service..." /etc/rc.d/rc.rsyslogd stop grep -h -v "input irq status" syslog.5 syslog.4 syslog.3 syslog.2 syslog.1 syslog >> tempfile diff <(tail -n 15 syslog) <(tail -n 15 tempfile) 1>/dev/null if [[ $? == "0" ]] then echo "The same" rm syslog.* else echo "Not the same" fi diff <(tail -n 15 syslog) <(tail -n 15 tempfile) if [[ $? == "0" ]] then echo "The same" mv tempfile syslog else echo "Not the same" fi /etc/rc.d/rc.rsyslogd start else echo "There is no issue" fi echo "Done"
  3. Hi, I've got a problem with logs, so I wrote a script to modify syslog files but after script is done logs not working, they are freezed and nothing is written to them. This happend when I modify "syslog" file. However I notice that when I was using this script for only "syslog.2" and "syslog.1" without "syslog", everything was fine; the logs were working and the lines with error was deleted. So maybe someone can help me find out how to make logs work after script is done or maybe someone know where is the problem. Maybe someone know how log works in unraid, how they are created, how they are splitted, what is the max size of syslog etc. and could explain it to me. I've checked permission after modification and change it to exactly how they was before modify but it not work and logs were still freezed. This is my script. I know it's kinda stupid but it might work for me. #!/bin/bash cd /var/log/ grep -v "input irq status" syslog.5 syslog.4 syslog.3 syslog.2 syslog.1 syslog >> tempfile diff <(tail -n 15 syslog) <(tail -n 15 tempfile) 1>/dev/null if [[ $? == "0" ]] then echo "The same" rm syslog.* else echo "Not the same" fi diff <(tail -n 15 syslog) <(tail -n 15 tempfile) if [[ $? == "0" ]] then echo "The same" mv tempfile syslog rm tempfile else echo "Not the same" fi echo "Done"
  4. Hi, I am having the same problem for a while and nothing works, so I wrote a script to delete this annoying issue. This is my script. #!/bin/bash cd /var/log/ grep -v "input irq status" syslog.5 syslog.4 syslog.3 syslog.2 syslog.1 syslog >> tempfile diff <(tail -n 15 syslog) <(tail -n 15 tempfile) 1>/dev/null if [[ $? == "0" ]] then echo "The same" rm syslog.* else echo "Not the same" fi diff <(tail -n 15 syslog) <(tail -n 15 tempfile) if [[ $? == "0" ]] then echo "The same" mv tempfile syslog rm tempfile else echo "Not the same" fi echo "Done" I know it is kinda stupid, but if it will work it won't be stupid xD. This is not my final version of script but while I was testing it I had ran into problem. My problem is after this scrpit is done unraid stops write anything to log. Logs are freezed and not work. This happend when I modify syslog file. However I notice that when I was using this script for only syslog.2 and syslog.1 without syslog, everything was fine; the logs were working and the lines with error was deleted. So maybe someone can help me find out how to make logs work after script is done or maybe someone know where is the problem.
×
×
  • Create New...