Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Simple Script Help [SOLVED]

Featured Replies

I'm trying to build a log file to trace my memory and see if I can track a trend where my server crashes after a couple of days.  Its been mentioned to use "free -h" to create a simple track.  I've used User Scripts (nice tool!) to create a cron job which works, but I'm trying to get the output readable in Windows Notepad.  Pretty sure I'm dealing with an ASCII character issue for CRLF, but not been able to find an answer online (they want to use echo -e or $ or /n, which has not worked).  Since almost all of our operating software today is a descendant of Unix, Mac, or MS operating SW, we are stuck with the line ending confusion - I just don't know the solution for DOS to read Linux!

 

#!/bin/bash
echo '======Start=======' >> /boot/log_free_memory.log
date >> /boot/log_free_memory.log
free -h >> /boot/log_free_memory.log
echo '======End=======' >> /boot/log_free_memory.log

The output I get does not match what I want when viewing the file in windows. 

 

However, it displays perfectly when I paste it into the code box and insert here (also displays fine if you cat the file):

 

======Start=======
Mon May 14 14:31:04 CDT 2018
              total        used        free      shared  buff/cache   available
Mem:            15G        3.5G        1.4G        520M         10G         10G
Swap:            0B          0B          0B
======End=======

And Programmers Notepad displays it correctly.

 

So I'm missing the magic.  How do I get windows editor to view the file correctly.  I suppose I could just use Programmers Notepad to view log files...  Suddenly dawned on me that editing config files with notepad is probably a no-no?!?  ?

Edited by jeffreywhunter

The easiest would be to use a true editor, like notepad++ which understands all formats.

 

If you insist in standard notepad and MS format, change your script like this:

#!/bin/bash
echo '======Start=======' | todos >> /boot/log_free_memory.log
date | todos >> /boot/log_free_memory.log
free -h | todos >> /boot/log_free_memory.log
echo '======End=======' | todos >> /boot/log_free_memory.log

 

  • Author
23 minutes ago, bonienl said:

The easiest would be to use a true editor, like notepad++ which understands all formats.

 

If you insist in standard notepad and MS format, change your script like this:


#!/bin/bash
echo '======Start=======' | todos >> /boot/log_free_memory.log
date | todos >> /boot/log_free_memory.log
free -h | todos >> /boot/log_free_memory.log
echo '======End=======' | todos >> /boot/log_free_memory.log

 

Thanks!  I think I'll go with the easiest (and most consistent for the rest of the world!).  I have programmers notepad which also works/reads the files perfectly...

It's rather interesting that notepad after all these years hasn't learned that if it uses the C runtime library and opens the file in text mode, then the runtime library will normalize both Unix and Windows line breaks into just a '\n' character - so it will only be mac-specific files that will have issues since they have reversed order of carriage return and line feed.

55 minutes ago, bonienl said:

Microsoft is excited they (finally) fixed the issue :)

 

Has someone really, really, important at Microsoft just died? Or how did they manage this ultimate feat of glorious high-tech coding?

1 hour ago, bonienl said:

Microsoft is excited they (finally) fixed the issue :)

See https://blogs.msdn.microsoft.com/commandline/2018/05/08/extended-eol-in-notepad/

 

 

20 minutes ago, pwm said:

 

Has someone really, really, important at Microsoft just died? Or how did they manage this ultimate feat of glorious high-tech coding?

 

I like the fact Notepad broke Linux files, it kept things exclusive..... :)

Edited by CHBMB

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.