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.

Script question

Featured Replies

I have a script that just does a

 

ls -lr on my user shares, the problem is that it turns white spaces into '\ '.  Any of the linux gods in here know how to create a directory listing without escaping white spaces?  Looked at printf but i'm not fimiliar with that command.

 

Thanks!

try  -N, --literal              print raw entry names

 

ls -lRN

 

root@Atlas /tmp #touch "x x"

root@Atlas /tmp #ls -l

-rw-r--r-- 1 root root      0 Apr 15 11:38 x\ x

root@Atlas /tmp #ls -lN

-rw-r--r-- 1 root root      0 Apr 15 11:38 x x

 

 

  • Author

ls -lRN did it!! Thanks!  On a side note, if i create a /var/stuff/ directory and then put and run my scripts out of there it wouldn't cause a conflict, would it?

 

Thanks!

ls -lRN did it!! Thanks!  On a side note, if i create a /var/stuff/ directory and then put and run my scripts out of there it wouldn't cause a conflict, would it?

 

Thanks!

no, but they will be gone when you reboot, as /var is only in RAM memory. (of course, it might be desirable for temporary files)

 

Many of us have adopted a "standard"

Use

/boot/custom/bin

for your custom scripts.

It (/boot) exists on the flash drive.

  • Author

ohh yeah i guess /var wont work then....  Again thanks for the help!  This forum has been extremely helpful.

ohh yeah i guess /var wont work then....  Again thanks for the help!  This forum has been extremely helpful.

It will work until you reboot...

 

Everything except /boot is completely set back to the original every time you reboot.  Then, a few files are copied from the config folder on the flash drive just after you reboot to set the initial configuration.

 

Other than those few, everything else is new, replaced by the files uncompressed from /boot/bzroot  (the unRAID distribution you loaded on the flash drive)

  • Author

ok got my uber simple script finished, now how do i schedule it?  Ive done some reading on the forum and i tried to copy my script (report.sh) to the /etc/cron.daily directory, but as you pointed out after a reboot the script was gone.  I did a crontab -l and get this:

 

root@Tower:/mnt/user/Movies# crontab -l

# If you don't want the output of a cron job mailed to you, you have to direct

# any output to /dev/null.  We'll do this here since these jobs should run

# properly on a newly installed system, but if they don't the average newbie

# might get quite perplexed about getting strange mail every 5 minutes. :^)

#

# Run the hourly, daily, weekly, and monthly cron jobs.

# Jobs that need different timing may be entered into the crontab as before,

# but most really don't need greater granularity than this.  If the exact

# times of the hourly, daily, weekly, and monthly cron jobs do not suit your

# needs, feel free to adjust them.

#

# Run hourly cron jobs at 47 minutes after the hour:

47 * * * * /usr/bin/run-parts /etc/cron.hourly 1> /dev/null

#

# Run daily cron jobs at 4:40 every day:

40 4 * * * /usr/bin/run-parts /etc/cron.daily 1> /dev/null

#

# Run weekly cron jobs at 4:30 on the first day of the week:

30 4 * * 0 /usr/bin/run-parts /etc/cron.weekly 1> /dev/null

#

# Run monthly cron jobs at 4:20 on the first day of the month:

20 4 1 * * /usr/bin/run-parts /etc/cron.monthly 1> /dev/null

#

root@Tower:/mnt/user/Movies#

 

I'm fine with my script running daily at 4:40 am, how to I change my crontab and tell it about my script /boot/myscript/report.sh???

 

Thanks!

You script, if placed in /etc/cron.daily AND made executable, will be run automatically by the existing "run-parts" command scheduled at 4:40

"run-parts" runs each of the commands it finds in the cron.daily directory in turn.

 

Assuming the report.sh is currently on the flash drive in /boot/custom/bin/

 

Putting these two commands at the end of your "/boot/config/go" file will copy the report.sh file into place each time you reboot.

cp /boot/custom/bin/report.sh  /etc/cron.daily/report.sh

chmod +x /etc/cron.daily/report.sh

 

Then, it is just a matter of waiting until morning.

 

Joe L.

Edit: fixed typo

  • Author

OK great, i guess i was missing the go script piece, Ill make the changes and see what happens, thank you so much!

Putting these two commands at the end of your "/boot/config/go" file will copy the report.sh file into place each time you reboot.

cp /boot/custom/bin/report.sh

chmod +x /etc/cron.daily/report.sh

That was a typo.  He meant...

cp /boot/custom/bin/report.sh /etc/cron.daily
chmod +x /etc/cron.daily/report.sh

 

Oops... you are right. I fixed the typo...
  • Author

Yeap, I figured out the cp statement after i modded my go script and rebooted and alas no script in /etc/cron.daily.  However this raises another question.  i looked through my syslog and didn't see something like 'could not copy report.sh' if there are problems/errors in your go script where would you go to find them?  in this case it was fairly easy to see what the issue was, but I'm sure its not always this cut and dry and would be nice to see a log to try to figure out what happens...

 

thanks!

Yeap, I figured out the cp statement after i modded my go script and rebooted and alas no script in /etc/cron.daily.  However this raises another question.  i looked through my syslog and didn't see something like 'could not copy report.sh' if there are problems/errors in your go script where would you go to find them?  in this case it was fairly easy to see what the issue was, but I'm sure its not always this cut and dry and would be nice to see a log to try to figure out what happens...

 

thanks!

You might look in /var/log/go

i looked through my syslog and didn't see something like 'could not copy report.sh'

if there are problems/errors in your go script where would you go to find them?

On the console screen. You can scroll it back with Shift-PgUp.

 

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.