PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, May 15, 2022

[FIXED] How to run a command automatically after each reboot

 May 15, 2022     linux, ruby-on-rails, ubuntu     No comments   

Issue

I currently have Ubuntu 16.04 installed on my virtual box. I installed Ruby and Rails by RVM. After that I tried

$ rails

The terminal said

The program `rails` is currently not installed. You can install it by typing:
 sudo apt install ruby-railties

I solve this problem by typing

$ source ~/.rvm/scripts/rvm

Credits here

However, once I reboot the virtual machine, everything I did with source will lose and I need to re-enter

 $ source ~/.rvm/scripts/rvm

I also have some similar cases I need to do on every reboot. So is there any solution can make those command be run automatically each time?


Solution

If you're using bash, add the line to the end your .bashrc:

.bashrc

source ~/.rvm/scripts/rvm

If you're using zsh, add it to you .zshrc.



Answered By - Anthony E
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing