Lets say that we’re writing bash script that should perform all the commands as a regular user, but it should also edit some files for which sudo command is needed. Writing sudo command won’t be much of a help as script might not ask for the password, and instead might just respond with “Permission denied”.
To import database dump into your PostgreSQL database, you can use following command: 1 pg_restore -i -h localhost -p 5432 -U username -d old_db -v database_backup.SQL Notice that port and username may be different for your PostgreSQL installation.
To create database dump from PostgreSQL, you can use following command: 1 pg_dump -i -h localhost -p 5432 -U username -F c -b -v -f database_backup.SQL Notice that port and username may be different for your PostgreSQL installation.
Magento uses md5 hashed values stored in the database as user’s password. This means that you can not retrieve the real password value no matter what and how important it is. And that’s actually really good since it protects user’s privacy and is more ethic way of storing personal data. And anyway, you can always […]
If .htaccess is not working on your Apache it is possible that it is not enabled. To enable .htaccess on Apache edit following file: /etc/apache2/sites-available/default Locate following line: AllowOverride None and replace it with: AllowOverride All Finally – run following two commands sudo a2enmod rewrite sudo /etc/init.d/apache2 restart Notice: This instruction on how to enable […]
If you ever find a need to, as a result of your custom action, display the 404 page to customer, you can do it by using the following code inside your controller class 1 2 3 $this->getResponse()->setHeader(’HTTP/1.1′,’404 Not Found’); $this->getResponse()->setHeader(’Status’,’404 File not found’); $this->_forward(’defaultNoRoute’); This way you’ll be calling the default Magento dispatcher and it […]
If you’d like to check if process is running on Linux OS, you can do it by using code from following snippet: command = "sidekiq" running = `ps ax | grep -v grep | grep $command | wc -l` if [running -gt 0]; then echo "Sidekiq is running!" else echo "Sidekiq is not running…" […]