How to install minishift in a customized directory in linux - linux

While trying to start minishift, it automatically updates the cache in the home directory.
/home/abc/.minishift/cache/.....
However I want minishift to use a custom directory instead of the default home directory as I am running out of space
Can this be achieved by changing any parameters during ./minishift start
Tried codeready containers too, but it copies in the default home directory..
FATA Failed to copy embedded 'crc_libvirt_4.5.1.crcbundle' from /opt/data/crc-linux-1.13.0-amd64/crc to /home/abc/.crc/cache/crc_libvirt_4.5.1.crcbundle: write /home/abc/.crc/cache/crc_libvirt_4.5.1.crcbundle: no space left on device

I found the answer to this :
export MINISHIFT_HOME=/opt/softwares/
echo 'export MINISHIFT_HOME=/opt/softwares/' >> ~/.bashrc
This helped in solving the redirecting the installation from home to customized directory.
Similar for crc installation as well.

As noted, you should use Code Ready Containers (CRC) and not minishift. This is a known issue and is being tracked here: code-ready/crc/issues/817.
The current workaround seems to be to create the directory where you want it to be and then create a symlink to ~/.crc:
mkdir -p /opt/crc
ln -s /opt/crc/ ~/.crc

Related

How to know who is deleting the files/directory

We have a directory /home/test/abc
Sometimes we found that the directory is not present. Most probably it is deleted by someone. We have lots of users who log in and out from the system.
I have checked the bash_history of all the users but nobody seems to have executed the rm command.
I would like to know if there is a way to monitor this directory and notify if a user or a script is trying to modify this directory.
I am using Centos
You can do two things:
You can install a utility that called acct (psacct), to monitoring on the user's activity on your machine.
You can install a tool that called inotify-tool, and after that, run the command: sudo inotifywait -m <your_file_path_here>, and it will monitor on your file activity in LIVE.

How to change NGINX install location Ubuntu 14.04

My aim is to change directory of NGINX installation to run as a web server. Motive - custom compiled NGINX, with functions which doesn't come with standard.
I've compiled NGINX from source and as was suggested on this page, all configuration was pointed in the new location /usr/local/nginx when compiled. Default installation is at /usr/share/nginx.
After starting the service, NGINX still runs on the default installation.
I've tried to load nginx with new configuration nginx -c /usr/local/nginx/nginx.conf which breaks everything, returning error 404 for index.html.
Multiple attempts at searching, only shows up with changing site directory.
Is there a solid solution to specify from where NGINX loads?
Edit:
As suggested by John Ankanna below, the following fixed it:
sudo mv /usr/share/nginx /usr/share/nginx.bkp - just renaming the
directory to recover current setup.
sudo ln -s /usr/local/nginx /usr/share/nginx - create symlink in place of original.
Debian/Ubuntu use a standard directory hierarchy. The command man hier will describe this for you. It is common for packages to create symlinks to place files in the correct place when the program expects them elsewhere.
Try Creating Symlink
sudo ln -s /usr/share/nginx /usr/local/nginx

Why does postinst script not execute commands while installing a debian package through Ubuntu software centre?

I have created a debian package and added the following code in the postinst script:
path="$HOME/sample"
echo "$path"
if [ -d "$path" ]
then
rm -rf "$path"
echo 'File deleted successfully :)'
fi
so that if the path is present, it would delete it during installation. It works perfectly when I install my .deb package through dpkg. But while installing through Ubuntu software centre, none of it works. Why does this happen?
For background, I have made an app that would create a directory in the home directory of the user or root installing to the system .So if I am reinstalling or installing again after uninstalling, I need to check if the directory is present or not; if present, I need to delete it. I have distributed the app as a Debian package. So the question is how to check if the directory is present in the home directory? The directory is not created while installing the app. It is externally created while running the app. Also note that I cannot change it to a different folder because the app cannot be changed.
The problem is not with Ubuntu, but with your use of HOME in the postinst. It apparently happens to work with sudo dpkg from your own account (although in some settings, sudo would not propagate your HOME then, either) but this is not supported or well-defined.
HOME does not make sense in a Debian package anyway, because it is a system-wide install, and HOME is a per-user variable.
If I understand your requirement correctly, you need to loop through the home directories of all users, and remove the sample folder from each if present.
# Ad-hoc
getent passwd | cut -d: -sf6 |
while read dir; do
test -d "$dir" || continue
rm -rvf "$dir/sample"
done
This is extremely intrusive so you really should try to change the app instead -- what if a user has a directory named sample for some other reason? The app should use a reasonably unique dot name (.appname-sample?) instead, or store its per-user data in a system location where it can be properly managed by the system.
In fact, in the meantime, your postinst script should probably only move the sample directory to something like .sample.dpkg-old. This is no less intrusive, but at least it avoids destroying your users' data completely by silly mistake.

OpenShift WordPress Theme Developer workflow

I create a application with Cartridges,
PHP 5.4
MySQL 5.5
phpMyAdmin 4.0
I commit my WP file, plugin and themes into GIT.
In my .gitignore, i added
wp-content/uploads
I did go through the book "Getting Started with OpenShift", as the book chapter 8 said
“The other directory available to you is the OpenShift data directory,
which is currently at $OPENSHIFT_HOMEDIR/app-root/data. We use the
environment variable OPENSHIFT_DATA_DIR to point to this location. ”
“The data directory is where your application should store its files
and put configuration settings, download themes, or generally anything
you want to survive restarts and Git pushes.”
Excerpt From: Steven Pousty and Katie J. Miller. “Getting Started With OpenShift.”
I access to SSH. When I upload my media in WordPress, It is store inside
$OPENSHIFT_REPO_DIR/php/wp-content/uploads/2014/05/1.jpg
1.How do I pointed it to?
$OPENSHIFT_DATA_DIR/uploads
If that is the case, in my .openshift/action_hooks/deploy file, I had added this script
if [ ! -d ${OPENSHIFT_DATA_DIR}uploads ]; then
mkdir ${OPENSHIFT_DATA_DIR}uploads
fi
ln -sf ${OPENSHIFT_DATA_DIR}uploads ${OPENSHIFT_REPO_DIR}php/wp-content/
However, the soft link script does not did it job, during my GIT PUSH, it shows the following error.
remote: ln: target `/var/lib/openshift/[ID]/app-root/runtime/repo/php/wp-content/' is not a directory: No such file or directory
my guess is, the $OPENSHIFT_REPO_DIR/php/wp-content/uploads/2014/05/1.jpg , the uploads folder already removed before the script do it job.
How do I keep the uploads folder content in such a situation. OpenShift expert kindly help in this matter.
After I had few attempt of the build script, I finally found out what is my problem.
To answer my own questions
How do I point it.
Create a symlink. During the GIT push, it will definitely delete your uploads folder ($OPENSHIFT_REPO_DIR/wp-content/uploads/).
This is the code you should use, just remove the php folder after the repo.
if [ ! -d ${OPENSHIFT_DATA_DIR}uploads ]; then
mkdir ${OPENSHIFT_DATA_DIR}uploads
fi
ln -sf ${OPENSHIFT_DATA_DIR}uploads ${OPENSHIFT_REPO_DIR}wp-content/
I hope it's help.
This file has plenty of examples
https://github.com/openshift/wordpress-example/blob/master/.openshift/action_hooks/deploy
The problem is that with every git push we are going to overwrite that directory.
I think a better idea is with every build rsync contents from your repo over to the data directory where it expects to find the themes (rather than doing the symlink)

Is there a system variable that stores the location of a user's Dropbox?

At least in the linux version of Dropbox, the user can choose which folder becomes their Dropbox. Is there a simple way to get this programmatically?
Maybe this will give you a clue. http://wiki.dropbox.com/TipsAndTricks/TextBasedLinuxInstall
The Dropbox configuration is stored in a sqlite database in your ~/.dropbox folder.
I found a small script which edits the Dropbox folder location:
http://dl.dropboxusercontent.com/u/119154/permalink/dropboxdir.py
http://cmdlinetips.com/2012/05/how-to-change-dropboxs-default-directory-location/
The most forward way to force Dropbox to use another folder location is a symbolic link.
Stop the dropbox daemon and simply replace the default folder with a symlink:
> mv ~/Dropbox /other/dropbox/folder
> ln -s /other/dropbox/folder ~/Dropbox

Resources