Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-16-2009, 03:41 AM
|
#1
|
LQ Newbie
Registered: Nov 2009
Posts: 12
Rep:
|
Scheduler/VB6 program running in Linux Fedora
Hi all,
I have made a vb6 porgram, it is running without any error in windows platform. However, i want it to be run at Fedora too. I run my program with Wine Windows Program Loader in a Linux pc, but the program stuck with an error message:
Run-time error '429':
ActiveX component can't create object
I thought it was the error message because of missing some dll/reference files, so I tried to copy all those related .dll & .ocx file into my wine file. (Just copy and paste into the system32 of wine, no regsvr32 statement to register the .dll as what we always do in Windows.) However, all my efforts are in vain. I not sure what is the cause of this error. Anybody can give me a hint on this issue?
p/s: My purpose to run the vb6 program in linux is because I want to make a scheduler in linux pc so that this program can be run once per day automatically and send email. Any suggestion on how to achieve this also are welcome. I am lost... Many many thanks!
|
|
|
11-16-2009, 03:49 AM
|
#2
|
Member
Registered: Nov 2009
Distribution: Gentoo, Slackware or Debian
Posts: 60
Rep:
|
content removed
Last edited by lewc; 11-27-2009 at 03:55 PM.
|
|
|
11-16-2009, 08:31 PM
|
#3
|
LQ Newbie
Registered: Nov 2009
Posts: 12
Original Poster
Rep:
|
VB6 program is just my piece of idea since I am totally new to Linux.
Before that I used to use vb6 program as my scheduled task in Windows.
What I want to achieve is, one scheduled program that can be run automatically everyday, check to the database for any due date, if yes, send an email to the person-in-charge; if not, just exit the program and then wait for the next run on tomorrow.
|
|
|
11-16-2009, 08:49 PM
|
#4
|
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083
|
What does the program do? If all you need is a scheduler you should look into cron.
About the database, what format are you using? If you just need to lookup a few registers in the database you should write a simple bash script to do so, and add it in your crontab or in /etc/cron.daily/. Using native tools will usually be easier. If you want the thing to be portable, you should be looking at portable solutions: like a web app using php or a program made using a portable toolkit, like qt4.
As for wine, I don't think it supports activex at all, I haven't heard of anyone using activex components under wine at least.
|
|
|
11-16-2009, 11:30 PM
|
#5
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.x
Posts: 18,443
|
|
|
|
11-16-2009, 11:44 PM
|
#6
|
LQ Newbie
Registered: Nov 2009
Posts: 12
Original Poster
Rep:
|
What i want is I can schedule a task so that it will execute my program everyday (for example in 12 midnight) automatically. While for the program, it is able to check my target database (in MySQL), which with one field named "due_date" in one of the database tables. if the due_date is reached, then the program need to send an email as a notification to the person-in-charge. If none of the due_date is reached, just exit the program and wait for the next run on tomorrow.
I already gave up the idea of runnig VB6 in Linux, now will concentrate on cron. Any idea on how cron can make it?
|
|
|
11-17-2009, 09:01 AM
|
#7
|
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083
|
Well, cron is the easy part.
You first need to concentrate on the small pieces before. If the database is in mysql then that shouldn't be a problem. This is what you need:
- find the way to do a query to your db from the command line, you need mysql installed for this of course
- once you have that value, the rest is simple bash
If you know sql, then you can write your query into a plain text file, then use it like this:
Code:
mysql -u [username] -p somedb < somedb.sql
Being somedb.sql the file containing the sql commands. In bash there's a expansion that allows you to use the output of a given command on a given sentence. Like this:
Code:
VAR=$(mysql ......)
How to parse it or even if this method is adequate depends on the query you are doing. Once you have a working query, you can paste the query and a sample of the output produced by it, and I can help with the bash part. I think that bash is adequate for this task, but any language will work. If you need to do some advanced parsing you might want to try perl instead, or python.
Once you have a working script the cron part is easy, you just need to copy it into /etc/cron.daily/ if you want it to run once every day.
|
|
|
11-17-2009, 08:07 PM
|
#8
|
LQ Newbie
Registered: Nov 2009
Posts: 12
Original Poster
Rep:
|
I created a simple "Hello Perl" script and just for testing purpose to see whether the cron works.
When i type ps aux | grep crond, I get this:
root 2145 0.0 0.1 5260 788 ? Ss Nov16 0:00 crond
admin 11098 0.0 0.1 4216 712 pts/0 S+ 09:58 0:00 grep crond
root 27812 0.0 0.2 5260 1220 ? Ss Nov17 0:00 crond
Then, I type : 01 * * * * perl /etc/perl/testing.pl
it returns: bash: 01: command not found
What is my problem?
If I run the script with perl etc/perl/testing.pl, it works with HELLO PERL printing.
|
|
|
11-17-2009, 08:22 PM
|
#9
|
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083
|
Quote:
Originally Posted by pu8y
I created a simple "Hello Perl" script and just for testing purpose to see whether the cron works.
When i type ps aux | grep crond, I get this:
root 2145 0.0 0.1 5260 788 ? Ss Nov16 0:00 crond
admin 11098 0.0 0.1 4216 712 pts/0 S+ 09:58 0:00 grep crond
root 27812 0.0 0.2 5260 1220 ? Ss Nov17 0:00 crond
Then, I type : 01 * * * * perl /etc/perl/testing.pl
it returns: bash: 01: command not found
What is my problem?
If I run the script with perl etc/perl/testing.pl, it works with HELLO PERL printing.
|
Well, there are a couple of them. Where exactly are you writing this line?
Code:
01 * * * * perl /etc/perl/testing.pl
That look like a crontab line, so it goes into /etc/crontab. The crontab file contains a list of scheduled tasks. That line will not run on command line (I think you did just that, because the error you pasted is descriptive enough). Of course, "01" is not a correct command on most linux systems, probably.
Another detail, even if you put that line into crontab, it is not probably what you intended, unless you truly want to run the script using the "perl" user.
Each crontab line has *exactly* six fields AND the remaining is the command to run (whatever number of fields you add after that is irrelevant).
The five first fields are date-related, the 6th is the user whose UID will be used to run the command under. The rest of the line is the command to run. In you case, the date fields are:
The user is:
The command line is
Code:
/etc/perl/testing.pl
You probably wanted this instead:
Code:
01 * * * * root perl /etc/perl/testing.pl
Hence the user would be
And the command line would be
Code:
perl /etc/perl/testing.pl
There might be additional problems with this. The first one is that this is run probably on a minimal environment, $PATH might not be set there so you should really use full paths always:
Code:
01 * * * * root /usr/bin/perl /etc/perl/testing.pl
The second problem is that cron tasks do not run attached to any particular vt, which means that a typical "hello world" will probably remain unnoticed (except for system logs if you have them set verbosely enough). You should probably modify it so it logs the output to a file, mail or whatever, and not stdout.
|
|
|
11-17-2009, 09:14 PM
|
#10
|
LQ Newbie
Registered: Nov 2009
Posts: 12
Original Poster
Rep:
|
Quote:
[root@xx ~]# 01 * * * * root /usr/bin/perl /etc/testing.pl
bash: 01: command not found
[root@xx ~]# 01 * * * * root perl /etc/testing.pl
bash: 01: command not found
|
This is what i get. Is the location I wrote the command correct?
|
|
|
11-17-2009, 09:27 PM
|
#11
|
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083
|
Quote:
Originally Posted by pu8y
This is what i get. Is the location I wrote the command correct?
|
Please, read the post above carefully. As I said, that line is not a command. It's a stanza that goes into the /etc/crontab file, which is the file from where the cron daemon read the scheduled tasks.
You should really read the crontab man page, which can be viewed with this command:
|
|
|
11-18-2009, 02:15 AM
|
#12
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.x
Posts: 18,443
|
|
|
|
11-18-2009, 03:12 AM
|
#13
|
LQ Newbie
Registered: Nov 2009
Posts: 12
Original Poster
Rep:
|
Ok, now I have edit my crontab file to be :
Code:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
#MAILTO=root
HOME=/
# run-parts
*/5 * * * * root /usr/bin/perl /etc/test.pl
Which the test.pl insert the date time NOW() into the database table. I want it to be run every 5 minutes so that I can see an immediate result.
Unfortunately, my cron job execute with an imperfection. That is, every 5 minutes, it insert the record twice.
checkdate
2009-11-18 16:45:01
2009-11-18 16:45:01
2009-11-18 16:50:05
2009-11-18 16:50:05
2009-11-18 16:55:02
2009-11-18 16:55:02
But if i run my perl script seperately, it works fine with only one record inserted.
|
|
|
All times are GMT -5. The time now is 08:49 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|