How to stop specific schedule task (cron job) in laravel 5 on live server cpanel - scheduled-tasks

I have created multiple schedule tasks in laravel 5, and created cron job on cpanel it is working fine. But now i want to stop specific schedule task, i have comment the command and remove class from app/Console/kernel.php file, but still it is running on live server on that specific time.
Befor in kernel.php
protected $commands = [
Commands\CreatePostingSchedules::class,
Commands\ChangeCreatedPostDuration::class,
Commands\abc::class,
Commands\xyz::class,
Commands\NewMonthUser::class,
Commands\DeliverOrdersWithCourier::class,
];
Now Remove the class Commands\ChangeCreatedPostDuration::class
After Removed the class:
protected $commands = [
Commands\CreatePostingSchedules::class,
Commands\abc::class,
Commands\xyz::class,
Commands\NewMonthUser::class,
Commands\DeliverOrdersWithCourier::class,
];
But still it is running on live server.
Please anyone can help ? how to stop this specific schedule task ?
Thanks

Make sure that you have completely removed the scheduled function/command from "Kernel.php" of your Laravel 5 and that you do not have related manual CronJob in your cPanel -> CronJobs.
You might also want to check this article: https://laracasts.com/discuss/channels/laravel/how-to-stop-scheduled-tasks-from-running-in-kernelphp

Related

Jfrog-Pipelines - Kill multiple runs of a pipeline branch via REST

I want to kill hundreds of pipeline runs of specific pipeline and specific branch (without deleting either of them). Any idea how I can do it?
This can be done via a script which first calls all the runs of pipeline with
GET /runs?pipelineIds=&statusCodes=
and then cancels them one by one using:
POST /runs/:runId/cancel
Status codes of incomplete runs are 4000, 4001, 4005, 4015, 4016, 4022
Refer documentation for more details

Laravel 8 "Queue::push" is working, but "dispatch" is not

I'm facing an issue with Laravel queued jobs.
I'm using Laravel v8.40.0 with Redis v6.2.5 and Horizon v5.7.14 for managing jobs.
I have a job class called MyJob which should write a message in log file.
If I use Queue::push(new MyJob()) everything seems to work fine: I see the job in Horizon and the new row in log file.
But if I use dispatch(new MyJob()) or MyJob::dispatch() it doesn't seem to push my job into queue: I can't see the job in Horizon and I see no results in log file.
I was following the docs (https://laravel.com/docs/8.x/queues#dispatching-jobs) to use queues correctly and I don't understand where I'm doing wrong.
Thank you

No error when stopping non existing service with chef

Im new to chef and trying to understand why this code does not return any error while if i do the same with 'start' i will get an error for such service does not exist.
service 'non-existing-service' do
action :stop
end
# chef-apply test.rb
Recipe: (chef-apply cookbook)::(chef-apply recipe)
* service[non-existing-service] action stop (up to date)
Don't know which plattform you are running on if you are running on Windows it should at least log
Chef::Log.debug "#{#new_resource} does not exist - nothing to do"
given that you have debug as log level.
You could argue this is the wrong behaviour, but if the service dose not exist it for sure isen't running.
Source code
https://github.com/chef/chef/blob/master/lib/chef/provider/service/windows.rb#L147
If you are getting one of the variants of the init.d provider, they default to getting the current status of a service by grepping the process table. Because Chef does its own idempotence checks internally before calling the provider's stop method, it would see there is no such process in the table and assume it was already stopped.

How to cancel or remove Persistent EJBTimers

When we use persistent EJBTimer with #schedule and persistent=true, deploy it to cluster and then we change the actual schedule within #Schedule and re-deploy to the cluster, does the original schedule get replaced with the new one ( removed and added with new parameters ), or both the schedules remain active ( keeping in mind the persistent=true is set )
This is what I have read so far - Each scheduler instance has a unique jndi name and #schedule automatically creates a timer through application deployment so it would be better to remove the automatic created EJBTimer or cancel the original schedule to avoid trouble. But I don't know how to cancel the original schedule programmatically or would that need to be done by the websphere admins, if both the original and changed schedules remain active
Also from this document, the removeAutomaticEJBTimers command is used to remove timers from a specified scheduler, but that also seems in the area of a websphere admin, not a developer.
How can a developer programmatically cancel an automatic EJBTimer created by using #Schedule annotation?
I am using Java EE 6 with Websphere 8.5 and EJB 3.1.
Do the following to remove persisted EJB timers:
Delete directory jboss-home\standalone\data\timer-service-data{yourporjectname}.{serivename}
See this page Creating timers using the EJB timer service
The application server automatically removes persistent automatic
timers from the database when you uninstall the application while the
server is running. If the application server is not running, you must
manually delete the automatic timers from the database. Additionally,
if you add, remove, or change the metadata for automatic timers while
the server is not running, you must manually delete the automatic
timers.
I have the following class:
#Stateless
#LocalBean
public class HelloBean {
#Schedule(persistent=true, minute="*", hour="*", info="myTimer")
public void printHello() {
System.out.println("### hello");
}
}
When I install it to the server, I can find related automatic timer:
C:\IBM\WebSphere\AppServer85\profiles\AppSrv02\bin>findEJBTimers.bat server1 -all
ADMU0116I: Tool information is being logged in file C:\IBM\WebSphere\AppServer85\profiles\AppSrv02\logs\server1\EJBTimers.log
ADMU0128I: Starting tool with the AppSrv02 profile
ADMU3100I: Reading configuration for server: server1
EJB timer : 3 Expiration: 2/14/15 12:39 PM Calendar
EJB : ScheduleTestEAR, ScheduleTest.jar, HelloBean
Info : myTimer
Automatic timer with timout method: printHello
Calendar expression: [start=null, end=null, timezone=null, seconds="0",
minutes="*", hours="*", dayOfMonth="*", month="*", dayOfWeek="*", year="*"]
1 EJB timer tasks found
After uninstalling application, the timer is removed:
C:\IBM\WebSphere\AppServer85\profiles\AppSrv02\bin>findEJBTimers.bat server1 -all
ADMU0116I: Tool information is being logged in file
C:\IBM\WebSphere\AppServer85\profiles\AppSrv02\logs\server1\EJBTimers.log
ADMU0128I: Starting tool with the AppSrv02 profile
ADMU3100I: Reading configuration for server: server1
0 EJB timer tasks found
I don't know how you are 'redeploying' your applications, but looks like your process is incorrect. As in normal install/uninstall/update process automatic timers are correctly removed.
UPDATE
On the same page you have info regarding ND environment:
Automatic persistent timers are removed from their persistent store
when their containing module or application is uninstalled. Therefore,
do not update applications that use automatic persistent timers with
the Rollout Update feature. Doing so uninstalls and reinstalls the
application while the cluster is still operational, which might cause
failure in the following cases:
If a timer running in another cluster member activates after the database entry is removed and before the database entry is recreated,
then the timer fails. In this case, a
com.ibm.websphere.scheduler.TaskPending exception is written to the
First Failure Data Capture (FFDC), along with the SCHD0057W message,
indicating that the task information in the database has been changed
or canceled.
If the timer activates on a cluster member that has not been updated after the timer data in the database has been updated, then
the timer might fail or cause other failures if the new timer
information is not compatible with the old application code still
running in the cluster member.
In JBoss/WildFly, if you change the timer-service to use a "clustered-store" instead of "default-file-store", you'll be able to programmatically cancel a Timer. Here is a brief guide explaining how to make it:
Mastertheboss.com: Creating clustered EJB 3 Timers
Published: 08 March 2015
http://www.mastertheboss.com/jboss-server/wildfly-8/creating-clustered-ejb-3-timers

Webistrano - how to clear global HTML cache after deployment

I am new to webistrano so apologies if this is a trivial matter...
I am using webistrano to deploy php code to several production servers, this is all working great. My problem is that I need to clear HTML cache on my cache servers (varnish cache) after the code update. I can't figure out how to build a recipe that will be executed on the webistrano machine (and will run the relevant shell script that will clear the cache) and not on each of the deployment target machines.
Thanks for the help,
Yariv
Simpliest method is to execute varnishadm tool with proper parameters inside deploy:restart
set :varnish_ban_pattern, "req.url ~ ^/"
set :varnish_terminal_address_port, "127.0.0.1:6082"
set :varnish_varnishadm, "/usr/bin/varnishadm"
task :restart, :roles => :web do
run "#{varnish_varnishadm} -T #{varnish_terminal_address_port} ban \"#{varnish_ban_pattern}\""
end
Thanks for the answer. I actually need to do some more stuf than to only clear the the cache so I will execute a bash script locally as described in below:
How do I execute a Capistrano task locally?