Execute script after FreeBSD is rebooted

olli@

Well-Known Member
Developer

Reaction score: 273
Messages: 315

Normally /.cshrc and /root/.cshrc are hard-linked and thus should be exactly the same.
Right. I tend to forget what the default is, because I always answer no when mergemaster(8) asks if those files should be hardlinks. I thought it was confusing if they're hardlinks.
 
OP
OP
S

Sessa

Member

Reaction score: 1
Messages: 44

I have set the env in the .cshrc file to "nano". When i reboot the system and type in "crontab -e" the crontab will be open by "vi".
What have i made wrong?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,181
Messages: 29,471

In your shell, what does echo $SHELL $EDITOR output?
 
OP
OP
S

Sessa

Member

Reaction score: 1
Messages: 44

EDITOR: Undefined Variable

So i set the editor var again with setenv EDITOR /usr/locale/bin/nano and checked again. Now the output is:

/bin/sh /usr/locale/bin/nano

After a reboot the output is again:

EDITOR: Undefined Variable
 
OP
OP
S

Sessa

Member

Reaction score: 1
Messages: 44

I have changed the /root/.cshrc and the /.cshrc file. The env variable is still not set after a reboot.
 

Vull

Well-Known Member

Reaction score: 104
Messages: 254

Login with the user name of the user who is executing crontab -e and put the following two lines at the end of the file .shrc and also at the end of the file .profile ...
Code:
export EDITOR=/usr/local/bin/nano
export VISUAL=/usr/local/bin/nano
Use the nano editor to make your changes by using these commands:
Code:
nano .shrc
nano .profile
Then enter the exit command at the command prompt to log out, because the changes won't take effect until you login again. Then login again as the same user name and execute the command crontab -e ... and you should find yourself using nano instead of vi or any other editor.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,181
Messages: 29,471

Then enter the exit command at the command prompt to log out, because the changes won't take effect until you login again.
No need to logoff. You can simply do source ~/.shrc or source ~/.profile. You can use the same command for the C shells too; source ~/.cshrc.
 
Top