What's the difference between "./" and "/" when using Apache related programs? - symbols

I don't know if it's actually Unix operation, but there are often times when the instruction says we should use "./bin/WHATEVER" while other times says "/bin/WHATEVER"
What's the difference?

A period means the current directory and a path that starts with a / is the very root of the partition. So this:
./bin/whatever
Means a folder called bin inside the current directory. Whereas this:
/bin/whatever
Means the bin folder is in the root of the partition.

Related

What is the exact role of tmp directory created by docker during its startup?

During initialization of the daemon, docker creates a tmp folder inside its root directory.
code reference
What is the exact purpose of this tmp directory, does that directory is only used to store temporary files related to docker, if yes does it only used in docker startup? Do containers also have access to that directory and use it to store their temporary files? Does it also cache some data for the next reboot of the host machine?
The prime objective to get this information is to estimate the size of the tmp directory and create a strategy for storing it.
I tried looking for the information in official docs, but I wasn't able to find any.
There is a question here regarding /tmp folder strategy, but this will only help me once I know what exactly tmp is used for.

Factor programming language: setting-up .factor-roots configuration

I downloaded the Factor programming language for Mac. I can now launch the command factor from the command line successfully. I read in a book covering this language (Seven More Languages in...) that, to run standalone programs I need to indicate the root paths from which Factor will search for vocabularies. I thus have to create a .factor-roots file in my home directory indicating the full paths to the root directories where I have my Factor source files, one path per line. My factor folder is in the /Applications folder. factor directory contains:
Factor.app git-id
README.md libfactor-ffi-test.dylib
basis libfactor.dylib
core license.txt
extra misc
factor work
factor.image
What should I exactly write in the .factor-roots file, to make it work?
SOLVED: I have to write into the .factor-roots file the path to the directory into which I write my standalone programs, not the path to the Factor installation directory.

How to map all containing folders using volume path docker

I'm new to Docker so let me know whether I should be doing something completely different, but here goes..
I'd like to create a volume within an nginx container which maps all sites-enabled configuration files to the location on the container. The catch is, these files are scattered across multiple folders which can be named at random. But wait! I can tell you for certain that the .conf file will always be in a specific folder only 1 level deep (because that's how I prefer the layout to be). Here's a basic layout explaining what I mean:
- images/
- nginx/
- docker-compose.yml
- sites/
- site_a/
- vhost/
site_a.conf
- site_b/
- vhost/
site_b.conf
I have tried to do this when declaring the volumes for nginx:
- ../sites/*/vhost/:/etc/nginx/sites-enabled
Yet I get the following error:
ERROR: for nginx Cannot start service nginx: mkdir /c/Users/Yates/Documents/docker/sites/*: protocol error
I kind of get the error, yet I can't find anything telling me how accomplish what I eventually want. Any help would be much appreciated.
Pretty sure you can't do this.
What you could do is symlink copy all the .conf files into a single directory on the host and use that as your volume mount point. Or just mount the sites/ root directory.
This is a conceptional question and your concept is very fragile and will lead to issues most probably.
What you are doing wrong is:
the configuration for the httpd server is kept inside the sites data/configuration structure or at least its nested inside
You are trying to configure a dynamic amount of 'services' sites using a static+nested folder. You are mixing up "configuration" and data. Try to put your configuration into something like consul/etcd/zookeeper and generate configuration usint tiller ( confd/consul-template)
If you to force it, you can:
Way a)
Mount the volume holding the sites folder in nginx, read only ( however this volume is called )
Then you runn an entrypoint script in the nginx container, some find expression to traverse your "sites" folder, find any site, use the vhost folder and create a symlink from there to /etc/nginx/sites-enabled
You need to also think about deletions, so pick a good namespaces for the symlinks, like mysite.automated.conf and before the entrypoint creates the symlinks, you run rm /etc/nginx/sites-enabled/*automated.conf to flush the potentially outdated/deleted ones. You can do it the update way also, but thats for more complicated..
way b)
If you can, change the structure of sites in general, extrac all "vhosts" into one folder, lets say you will have
sites/vhosts/*.sites.conf
sites/data/siteA/
sites/data/siteA/
and then mount the volume read-only on nginx and symlink sites/vhosts to /etc/nginx/site-enabled ( the folder itself )

How can I create an API directory using the Google App Engine's Service Generator?

I've been following the instructions on Google's Doc. ->
https://cloud.google.com/appengine/docs/java/endpoints/consume_ios#Java_Compiling_the_client_library_generator_and_generating_your_library
But I cannot get past step 5 (Compiling the client library generator and generating your library)
/Users/username/Library/Developer/Xcode/DerivedData/ServiceGenerator-btnyogexyyjtgrgbfjqddcedmkls/Build/Products/Debug/ServiceGenerator \ /Users/username/Documents/discoveryFileName.discovery \ --outputDir /API
However, I get the error - "ERROR: An output directory is required".
Any ideas?! I clearly put the output Directory in there. Would this error occur if the discovery file was not in the correct format?
I've tried many different output directories as well
Please!!
I see you're using --outputDir /API -- that is, trying to create the directory right under the root directory in your filesystem.
The example uses, instead, --outputDir ~/API -- that ~ sign just before the / means it creates the directory inside your home directory (in Unix-like systems).
You may miss permissions required to create directories at the top of your filesystem, while you likely have such permissions within your home directory. Therefore, I would recommend doing exactly what the example suggests -- keeping the ~ (tilde) there, rather than removing it.

dot sourcing with relative paths in powershell

I am trying to figure out how to use relative paths for Powershell scripts. I have dot sourced with absolute paths, but the scripts that I am writing may end up in a different base directory so I need to make sure the path is relative so it can be picked up. How can I do that?
So far I have tried:
. .\scripts\variables.ps1
That always throws this exception:
The term '.\scripts\variables.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program...
That lets me know it can't find my script? So, what am I doing wrong?
You can use : . $PSScriptRoot\scripts\variables.ps1
Here $PSScriptRoot is the path of directory of the running script.
This is not what the OP asked for but may be useful for others who are searching:
If you need to traverse up, you can use . $PSScriptRoot\..\scripts\variables.ps1
This works for structures such as:
root
scripts/shared directory
directory your script is executing in
If you know that your script directory structure is going to remain the same, you could use $PWD; eg:
. "$PWD\scripts\variables.ps1"
The above assumes that your script (the calling script) is in the same directory that contains the scripts directory.
Also, the assumption made here is that you're checking out/downloading all your scripts in the same structure, but as you put it, they may end up being in a different base directory.

Resources