I am new to CakePHP and I am making an application where users fill out forms and then other users who are specified on the form have to add to the data. At the end of each day I want to send an email to all users who have been referenced on forms that day and tell them how many new forms they need to add information to.
I know how to run my query to figure out who I need to email and how to construct the email, but how do I make it happen once a day or at any set time? I have found something about cron jobs in my research but I don't fully understand or know if that will work for me. I am working in a Windows environment and launching my app on a heroku server currently.
Thanks for any info!
Cheers,
Jon
Although this question is not really related to CakePHP but rather to Heroku, I suggest you install that Heroku Scheduler Addon.
Once installed, you can write a shell script, such as follows:
#!/bin/sh
php -f path_to/your_php_file/which_sends_emails.php
and name it sendemailjob.sh or something. Make it executable by
sudo chmod +x sendemailjob.sh
After that, you just need to tell Heroku Scheduler to daily execute that file. Should not be too much magic.
Although I am not quite sure whether you actually have shell access since you're on Windows, maybe there is a different solution for Windows.
Related
I have everything set up so that my discord bot runs on Google Cloud, but my only problem is that I can't seem to figure out how to update or delete files on the cloud disk drive. I am searching everywhere and I can't seem to find it. This bugs me because now I have to completely rename my bot every time I upload it or else I can't run it. This issue is really hurting my coding because I want to move forward, but I am very thorough and this issue will haunt me if I just leave it be.
I found the answer finally and to edit files you have to use vi, vim, or nano in the terminal. To remove the files you have to use rm. I think Google should make a better way to access the directory and edit my disk without having to use command lines, but I doubt they will.
Please note that GCP only offers e virtual infrastructure (for Compute Engine). The VM still runs a regular Operating System (with certain files pre packaged in to make sure it works with the cloud environment). Management of the operating system is still up to the user.
You can use something like App Engine if you only want to manage and update the code for your application.
Alternatively, you can also use gcloud compute scp to copy files from a local system directly to the VM.
I'm new to this workflow using Git, and I feel like I'm missing one piece of information that's just not obvious to me. I setup a sandbox on Pantheon and did a Drupal install thru Pantheon. Works fine on dev. Then I cloned it to my local, but when I open my local up in a browser it wants to install Drupal, like it was never setup on Pantheon. My best guess is that it's not pulling the database, can't find it, and figures it's a fresh install. But how do I connect the dots here? Thanks!!
You are correct, the database does not pull down with git, only code.
You will either need to manually download the database from their UI or use their command line tool named Terminus. If you're comfortable with the command line, Terminus is the most convenient.
Another option would be to use Kalabox. This is a local dev environment tool which was just released. I haven't tried the latest release yet but have read users reporting it integrates with Pantheon nicely.
I am trying to install piwik on my machine using XAMPP as it requires PHP, apache and mysql. When i installed XAMPP and launched apache, it worked fine but when i am trying to access MySql admin through XAMPP or access sample php page (copied on xampp/htdocs folder), apache is getting redirected to IIS which is then not able to view page, showing 404.3 error (its looking for file in wwwroot, which is also not working after pasting in wwwroot).
My objective is to make piwik up and running on my machine. Another option is Unix server which is very new to me (i have been working in Windows ). I know one should have a web server loaded with MySql and PHP to run piwik (which is hardly half an hour job once we have all these) but coz different resource available, i am struggling to get this thing done.
Any help is highly appreciated.
After two days of R&D, i figured it out (well, sort of). So for anybody who is new in piwik and in linux/apache/php/mysql, here is what i did to achieve the objective. For those of you who are familiar with all these or few of these, you might have a better way or answer and i would really request you to improve this answer but this is to help someone who is new and does not know all things at once.
Here is what i did
--get apache
--get php (one of the requirement for piwik)
--get sql (again requirement)
--all should be running (get wamp (its carrying all three of the above)), make sure apache is running on port 80.
--install mysql but make sure only wamp's sql is running
--set passowrd for root in wamp->mysql-->mysqlConsole-->set password for 'root'#'localhost'=password('yourPasswordHere');
--Paste piwik folder in www directory
--open localhost through wamp,login in adminer and phpmyadmin (bottom right)
--run http://localhost:8080/piwik-->u will see directory listing, click on folder piwik. You should be able to see welcome screen for piwik installation
--make sure we have php 7 as selected version in wamp( for php, wamp was carrying two version so we can choose) to avoid error in system check step of installation
--Follow the steps which are very straight forward.
This is something which worked out for me. Actual answer might be simpler or better. Hope it will help someone who is probably banging his/her head around and hitting some walls without getting something concrete.
Happy to help!!!
I need to automate a manual process in which a user need to login on several wesite with specific username and password and also checks some links(shared locations). If everything is normal then user send a mail to the specific group in table format.
Can anyone give me any idea, how to start the automation process. I am thinking of using .bat and .vbs.
Thanks in Advance.
Here's what I would do:
Set up a headless Ubuntu machine (either on-premise or in the cloud)
Install Jenkins
Get familiar with creating Jenkins jobs and configuring them to email your group upon success or failure
Install the PhantomJS web browser on the Ubuntu box
Use the Python Selenium bindings to write a web automation script that uses PhantomJS to perform your web tests
Finally, create a Jenkins job that runs that test script and emails you the results
With that infrastructure in place, you'll have a solution for the task at hand, and a foundation on which you can build many more tests and processes.
If you have a hard requirement to use Windows and .bat files, you can do that too - just install Jenkins on a Windows machine and configure your Jenkins jobs to execute batch commands. I still recommend using Python even if running on Windows, though.
I think bat won't help you because it can't actually interact with a browser e.g. to enter username and password.
I'd go with AutoIt. It's simple and powerfull and has a nice framework for browser interaction.
If you want to use something complicated but really powerfull (C#), check the white framework by teststack.
I've got a wordpress site that I have been using for a year now and it is hosted with HostGator. I have got a few tests i would like to run on the site, but I would like to test it offline using wamp first before making it LIVE.
The problem is previously I was always making changes to the LIVE site, usually at hours when I get little to no traffic. However, that has changed now and I do get traffic most hours through out a 24hr day.
So my problem is:
How do i download my existing website to laptop (wamp) and make those changes with new theme? (total newbie, sorry!)
I use Windows 7, so not sure what I need to be doing to get the site working like a live site offline.
Once I have implemented the new changes, what is the best way to upload the updated site back to the HostGator server without having any downtime or errors for site visitors?
Is there anything else I need to install or do inorder for this to work? I hope you can give me as much information as possible or any links to any guides or articles that explain how to do this.
Thanks so much for any help you can offer!!!
If you're using Hostgator, the process is simple:
Install XAMPP or WAMPP on your computer;
Go to your cPanel, backup and download your website;
Extract the backup to your computer, specially the homedir and the sql;
Go to your local environment, access http://localhost/phpmyadmin
Create a new database, doesn't matter the name but for the example let's call it "database";
Inside that database, import the one taken from the backup;
create a new folder inside your htdocs with the name of your website, "example.com";
Extract the content of the homedir there;
edit wp-config with the following data:
Host: 'localhost'
Username: 'root'
Password: blank
access http://localhost/example.com
You can check a good tutorial about the subject here.
About putting the site live, I recommend you to use a GIT repository, however it's understandable that might be a little complicated and perhaps too much work for what you're trying to achieve.
Try to move your files directly from your local to live environment using Filezilla or WinSCP, the drag and drop should replace the files live and the downtime should be minimal.
Instead of WAMP, you can always use VirtualBox to install CentOS or Ubuntu/Debian.
You can go one further and install either CentminMod to automate creating a LAMP, or a full panel like ISPConfig or Virtualmin.
That take care of create the environment.
Create a new account on the LAMP, using the same domain name.
You can FTP with Windows to get the files, but networking Windows and Linux is a pain. The better option is to use the command line (CLI) in the Linux VM to ftp the files from Hostgator to the VM. This guide will help with that process: http://www.tldp.org/HOWTO/FTP-3.html
Then your only concern is the MySQL database. And for this, you have several options.
For me, the easiest is to buy (or try!) SQLyog on Windows, and then copy the database from the Hostgator source to the localhost destination. Some mild networking is needed for Windows to see the Linux VM, but nothing as complex as file sharing (the FTP issue). SQLyog is far quicker than backing up the database, then restoring it -- especially since you can run into memory issues doing it this way. It fully depends on the size of the database.
The cheap/free backup>restore method is to use phpMyAdmin.
WordPress also has plugins, of varying cost, but you still have the possible backup>restore memory issue there as well.
When done, just copy it the other way, again using SQLyog and CLI ftp. You'll still have some downtime, but it will hopefully be minimal.
As a newbie, this probably seems like rocket science, but at least it gives you a good place to start. Welcome to the world of locally dev'ing sites!