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.

How to: add directory to path

Featured Replies

I've got no idea...  One difference I can think of is the search PATH used for commands might be different. (Causing the shell to traverse different directories when looking for the commands to run)

 

 

My cache_dirs lives in /boot/custom/bin.  I invoke it like this in my "go" script.  my drives spin down just fine.  I add /boot/custom/bin to the execution path in the "go" script.

(This is my whole "go" script.)

#!/bin/bash

# Start the Management Utility

/usr/local/sbin/emhttp &

PATH=$PATH:/boot/custom/bin

cache_dirs -w -e Pictures -e data -d 3

fromdos < /boot/custom/bin/powerdown > /sbin/powerdown

chmod u+x /sbin/powerdown

fromdos < /boot/custom/etc/rc.d/S30-inittab-powerdown | sh

fromdos < /boot/custom/etc/rc.d/rc.local_startup | sh

echo "/boot/unmenu/uu" | at now + 1 minute

 

I'm tring to figure out how to add a directory to the path but am having no luck.  I found this example from Joe L. which is the exact directory I want added to my path but when I copy this line into my go script it does not seem to work.  After rebooting /boot/custom/bin is not in my path.  What do I needto do in order to get this working?

I've got no idea...   One difference I can think of is the search PATH used for commands might be different. (Causing the shell to traverse different directories when looking for the commands to run)

 

 

My cache_dirs lives in /boot/custom/bin.  I invoke it like this in my "go" script.   my drives spin down just fine.   I add /boot/custom/bin to the execution path in the "go" script.

(This is my whole "go" script.)

#!/bin/bash

# Start the Management Utility

/usr/local/sbin/emhttp &

PATH=$PATH:/boot/custom/bin

cache_dirs -w -e Pictures -e data -d 3

fromdos < /boot/custom/bin/powerdown > /sbin/powerdown

chmod u+x /sbin/powerdown

fromdos < /boot/custom/etc/rc.d/S30-inittab-powerdown | sh

fromdos < /boot/custom/etc/rc.d/rc.local_startup | sh

echo "/boot/unmenu/uu" | at now + 1 minute

 

I'm tring to figure out how to add a directory to the path but am having no luck.  I found this example from Joe L. which is the exact directory I want added to my path but when I copy this line into my go script it does not seem to work.  After rebooting /boot/custom/bin is not in my path.  What do I needto do in order to get this working?

The reason it does not work for you is that you do not run the "go" script when you log in.

 

A login shell gets its path from two places in linux.  a system wide file

/etc/profile

and a user-specific file located in the user's home directory

.profile

 

The system wide file is evaluated first, then the user-specific one.

 

The user-specific one does not currently exist in unRAID. If it did, it would exist as /root/.profile  ( .profile in the home directory of the user logging in)

 

To create the ".profile" file, we can add a line in the "go" script.  Then, when we next log in, ".profile" will be evaluated and your PATH set.

 

The line you need to add to the "go" file is:

echo "PATH=$PATH:/boot/custom/bin" >/root/.profile

 

Joe L.

  • Author

Thank you, I would have NEVER figured that out on my own.

 

If I also wanted to use the next line, cache_dirs, shown in the go script would I need something like this then?

 

/usr/local/sbin/emhttp &

PATH=$PATH:/boot/custom/bin

echo $PATH >/root/.profile

cache_dirs -w -i Videos

 

Thank you, I would have NEVER figured that out on my own.

 

If I also wanted to use the next line, cache_dirs, shown in the go script would I need something like this then?

 

/usr/local/sbin/emhttp &

PATH=$PATH:/boot/custom/bin

echo $PATH >/root/.profile

cache_dirs -w -i Videos

 

No... close, but not quite

The second line needs to be

echo "PATH=$PATH" >/root/.profile

 

Otherwise, what ends up in .profile is a line looking like this

/usr/local/sbin:/usr/sbin:/sbin:./:/usr/local/bin:/usr/bin:/bin

instead of this

PATH=/usr/local/sbin:/usr/sbin:/sbin:./:/usr/local/bin:/usr/bin:/bin

 

  • Author

Thank you, I would have NEVER figured that out on my own.

 

If I also wanted to use the next line, cache_dirs, shown in the go script would I need something like this then?

 

/usr/local/sbin/emhttp &

PATH=$PATH:/boot/custom/bin

echo $PATH >/root/.profile

cache_dirs -w -i Videos

 

No... close, but not quite

The second line needs to be

echo "PATH=$PATH" >/root/.profile

 

Otherwise, what ends up in .profile is a line looking like this

/usr/local/sbin:/usr/sbin:/sbin:./:/usr/local/bin:/usr/bin:/bin

instead of this

PATH=/usr/local/sbin:/usr/sbin:/sbin:./:/usr/local/bin:/usr/bin:/bin

 

 

lightbulbtransparent2.gif AH!

 

Once again - THANK YOU

  • 6 years later...

Hey sorry to dig this up from the graveyard, but I'm having trouble getting this to work. I have this in my go script:

PATH=$PATH:/usr/lib64/jre1.8.0_45/bin

echo "PATH=$PATH" > /root/.profile

 

And when I login, my .profile shows the correct path, but if I actually check $PATH, it doesn't contain the directory I added.

 

Am I missing some simple step?

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.