Weblogic server status script using unix batch file - java

I am checking my weblogic server status(running or stop) through weblogic console. But i paln to automate by using unix script. Can u plz give me the unix scripts(.bat) to check the web logic server stsus. After running unix(.bat) i want to track server status in text file.

This example does what you need. With a few minor tweaks, you can get it to work for you.

Related

Automating Scheduled Task- Running main.java file

Daily i run a job in eclipse its batch job every day 11 pm. It's a main.java file need to run java application once executed i have copy the console output log into a notepad and i save with name as log file(exmaple.log), this file has to be posted to the particular share point portal, and an automated mail should be shared to the group about the file.
I want to automate this process. Please help me out, i am new to this process, but trying to automate the process which manually executing daily basis.
Since you added shell and cron, i am assuming it's kind of unix.
Verify server got connectivity to SharePoint server and mailx is enabled. If it's present you can do everything from server itself. This will be my approach.
Modify code
To log the required data to a file. You can either use a simple file
writer or use logging libraries.
Upload file to share point using share point rest api. Java httpclient can be used to execute http requests.
Use javax mail to send email. Or use native mailx unix command.
Convert java class to jar file. Schedule as cron job.
If you don't have connectivity. We have to do everything from local machine.
In that case, code should be modified to connect to server and execute remotely over ssh. Use cron or windows schedules for job management.

How to execute MSDOS Command from browser (PHP or Java)

I have a USB line display, similar to the ones that are used in store point of sale systems.
To print ABC to this line display, I run the following command:
echo ABC > \\.\LCLD9\
This prints ABC to the line display.
I'm trying to figure out how to control this output from a website, if possible, although I am not sure if it would be possible, as I can see security issues with being able to run arbitrary commands form web pages.
I'm trying to figure out how to control this output from a website, if possible, although I am not sure if it would be possible, as I can see security issues with being able to run arbitrary commands form web pages.
This is indeed not possible on an unmodified system. There is no way for a web page to run an arbitrary command on the user's machine -- that is the definition of a security vulnerability.
If you can get the user to install software ahead of time, you could use a Chrome extension with the serial, usb
or nativeMessaging APIs to expose this functionality to web pages.
Check out function shell_exec. http://php.net/manual/en/function.shell-exec.php
There are several ways to do this. One way is to simply have your website store the current text somewhere and then build a script on the local PC that asks your website for the current text and updates the display. You can schedule that script to run periodically using the Task Scheduler.
This script can be as simple as this (assuming PHP is installed on your local PC):
<?php
$text = file_get_contents('https://example.com/current_text.php');
shell_exec('echo "' . $text . '" > \\.\LCLD9\');
If you don't have PHP installed and don't want to install it, you can probably do something similar in a Powershell script or in a plain old batch file.
Note that you probably want to add some extra checks to this, you don't want to accidentally clutter your display with a 404 error page, a 500 internal server error or a network error.

java web start app on localhost using WAMP is not able to run php scripts?

I have a signed java web start app that has been running on a server for many years. I have a need to create a version that I can run on a local machine. I have setup WAMP and the database and confirmed that these work by accessing through php scripts via localhost. My java program is also launching but there is a problem when it tries to access a local php file through locahost. Nothing is returned. I call php scripts that access the database from within the java app. Am i missing something fundamental here? ANy help appreciated. Thanks
Thanks for the responses. The problem has been solved. I forgot to turn off deprecation and other warnings so what I was getting back from the php scripts was not what I expected. Once I turned off the warnings everything functioned as expected. To sum up, I am serving up a java web start app through localhost, executing php scripts from within the java app that manipulate an sql database, and return the results to the java app.
Thanks again,
greg
Well are you using Quercus ? It would have been easier to suggest a solution if you had mentioned how you are running php scripts in java app.
Basic thing here is you should always call your php file using classpath or path associated within the project
PHP php = new PHP("classpath:/com/demo/phpfile.php");
or sometimes you could use(os path if set up correctly) path of file as accessed by you operating system.
C:\websites\www\myproject\phpfile.php(example windows path)
if you are accessing files like http://localhost/myproject/phpfile.php
then the php file is executed by the wamp server and html output returned. so you do not get the php script.
If you are trying to run java inside php then you could call php files in the manner http://localhost/myproject/phpfile.php to see the end result.

Backend generates pdf files (labels, packing slips, etc) - Need to automatic print to pre-selected printers from browser - Workaround?

I'm in the process of developing a web application; where in the admin backend I need to have the functionality to do automatic print jobs for different processes that run and generate a pdf (labels, packing slips) in admin that will be sent to pre-selected LAN network printers in my warehouse.
I've been doing some research on this and I know due to security issues automatic printing like this is hard to configure. However, I have some posts where people write that they were able to pull this off with active x, java, print server, client software, etc...but there isn't a clear outline on how exactly to do this.
Can someone help me figure out a workaround that I can use to be able to automatically print to different LAN network printers in my warehouse when a certain process runs and generates a pdf file?
Thank you!
I also manage a warehouse system that does these tasks. I will not claim that the following solutions are the best way to go, but they have been working for us. Our system is built using PHP 5.3 on a Windows server using Apache. With this setup, the user does not need to print anything from the browser, it's all handle server-side.
Requirements: Apache needs to be running with Administrator privileges. Probably not recommended for web-facing servers.
To print a PDF on Windows via PHP:
$file = "c:\\path\\to\\file.pdf";
$exec = '"C:\\Program Files\\bioPDF\\Acrobat Wrapper\\acrowrap.exe" /t ';
session_write_close(); // prevents hanging
pclose(popen($exec. $file . " \\networked\\printer",'r'));
This just launches reader, prints the file, and closes reader.
On a Linux/Mac you should be able to use (without Admin privliages):
$file = "/path/to/file.pdf";
$command = "lpr -P /printer/path " . $file;
exec($command);

installed a jetty server. Do I need other configurations for it to run php/java code?

I have previously installed xampp on my remote linux server. So I already have php pre-compiled. Java also. I installed a jetty server. Do I need other configuration to it to run both PHP and JSP?
I want to use JSP and jetty server instead of PHP and apache for scaling issues regarding a notification system that I will soon apply. Any feedback on this descision will be apprecitied
See their documentation for PHP support.

Categories